java in windows2003 can not load jar correctly - java

I have a flume agent run on different servers.It can work in centos and windows 2008.
But when I run it in windows 2003,It got errors.
All point in the path is replaced to '/',what's wrong with it?I guess that which windows variable is not be correct set?
Thanks.

When you set your agnet using bin/flume-ng.... make sure to specify the file where the agent configuration is.
--conf-file flume_Agent.conf -> -f conf/flume_Agent.conf

Related

Customize Spring Boot executable-jar startup script

I'm trying to run Spring Boot executable-jar built using spring-boot-maven-plugin on a Linux machine. The machine has multiple jdks installed, the one on PATH is jdk8 and changing it is unfortunately not an option. My executable-jar however needs jdk17, so when I just launch it as is I get UnsupportedClassVersionError.
I was following the official documentation and created the corresponding .conf file to override JAVA_HOME. But this does not seem to solve the issue:
[root#ios-maket updater-new]# ls
updater-new-3.0-SNAPSHOT.conf updater-new-3.0-SNAPSHOT.jar
[root#ios-maket updater-new]# cat updater-new-3.0-SNAPSHOT.conf
JAVA_HOME=/opt/jdk-17/bin/java
[root#ios-maket updater-new]# ./updater-new-3.0-SNAPSHOT.jar
Application is running as root (UID 0). This is considered insecure.
Exception in thread "main" java.lang.UnsupportedClassVersionError...
On the other hand if I run it manually everything works fine:
[root#ios-maket updater-new]# /opt/jdk-17/bin/java -jar ./updater-new-3.0-SNAPSHOT.jar
[main] INFO com.icl.ios.fias.updaternew.UpdaterNew - Starting UpdaterNew using Java 17.0.6
What am I doing wrong?
Setting JAVA_HOME is not enough, you also need to set PATH to point to JAVA_HOME/bin.
JAVA_HOME=/opt/jdk-17
PATH=${JAVA_HOME}/bin:$PATH
java -jar updater-new-3.0-SNAPSHOT.jar
Try running the jar with -Dloader.path to specify the config manually.
java -Dloader.path=./updater-new-3.0-SNAPSHOT.conf -jar ./updater-new-3.0-SNAPSHOT.jar
If this still does not work, then probably there is an issue with your config file, but from what I can see, your config file looks okay, unless the java path is incorrect.

How to run JMeter through CMD from jdk/bin directory?

I want to run JMeter test plans from a UNIX server where env variables for java is not set. Its a test server and I dont have access to set that. We have different JDK versions and all are sitting in directories. I need to run my JMeter TestPlans on this server. I went to JDK /bin folder and tired to execute the below command
$ {jmeter-path}/bin/jmeter -nt testplan.jmx -l testresult.jtl
but this says
./bin/java: not found
But if I do simple java -version it shows the version result.Is that something that JMeter needs specifically the java env variable set or it wont run ? I dont have permission to set and I want to run the testplan using the JDK/JRE from its directories. A help would be appreciated. Thanks in advance!
UPDATE:
I think I could work around this by editing the jmeter script file as suggested in the one of the comments. Since my requirement was running the JMeter from a specific server, I could achieve this by editing the JAVA_HOME variable value in the script.
JMeter looks for java executable in system PATH so you have 2 options:
Add bin folder of your JDK or JRE to PATH, something like:
PATH=$PATH:/location/of/your/jbk/bin && export PATH && {jmeter-path}/bin/jmeter -nt testplan.jmx -l testresult.jtl
Or if you have java in PATH just run ApacheJMeter.jar like:
java -jar {jmeter-path}/bin/ApacheJMeter.jar
You might also want to use jmeter.sh wrapper script instead of jmeter, it has some logic regarding java binary location
More information: Get Started With JMeter: Installation & Tests
The official JMeter Getting Started documentation says this:
To install a release build, simply unzip the zip/tar file into the directory where you want JMeter to be installed. Provided that you have a JRE/JDK correctly installed and the JAVA_HOME environment variable set, there is nothing more for you to do.
Based on the symptoms that you reported, I think that you have not set JAVA_HOME correctly. It should be set to an absolute path to your Java installation's top directory.

Running a Java/Selenium program on another computer

I have a small Java program that uses Selenium that I'd like to install on someone else's computer so they can use it too. It uses Selenium (for what it's worth).
I exported from Eclipse to a jar file. I then used launch4j to create a windows executable. I used Java version 1.7_079 to develop the program.
The other computer has JRE version 1.7_079 installed I made sure CLASSPATH is set.
If I run this executable on my system it works fine. If I try and run it on another system nothing happens at all, no errors, no nothing.
What am I doing wrong?
Would it be easier to NOT wrap it in an executable and just use a batch file to run it?
what's the best and easiest way to accomplish this?
Try to execute the .jar directly on the system where it doesn't work by using java.exe/javaw.exe and note the error, if any.
java.exe -jar helloworld.jar
If you get "'java.exe' is not recognized..." you need to add the folder where java/w.exe is to your path (eg: SET PATH=folder-with-java-exes;%PATH%
You can locate java/w.exe files with:
cd /d c:\
dir /S java*.exe
I finally have an answer to this. I traced it down to an issue with Chrome and Chrome driver. I was running Chrome v55.0.x. The users computer was running 57.0.. Once I upgraded my machine to 57. it failed like the users did. I updated Chrome driver and everything works as expected.
you can try this in your code put the path as C:/xxxxxxxx.exe
and put selenuim and the web driver In the C drive and create a jre or exe now .
next step is to ask your client to put selenuim and the web driver also in the C drive in there computers and int will work fine .

How to configure apache tomcat server

I have install jdk1.6.0_04 and I have also install apache-tomcat-8.0.9
and I have set path C:\Program Files (x86)\Java\jdk1.6.0_04\bin;
and CLASSPATH appache tomcat server
C:\Program Files (x86)\apache-tomcat-8.0.9\lib\servlet-api.jar;
but still it's not working properly when i try to open apache tomcat server on web browser
web page is not available
Please guide me the correct way to achieve my objective.
Set JAVA_HOME="C:\Program Files (x86)\Java\jdk1.6.0_04" and CATALINA_HOME="C:\Program Files (x86)\apache-tomcat-8.0.9" than go to %CATALINA_HOME%\bin and run startup.bat
All simple configuration in %CATALINA_HOME%\conf\server.xml
You need jdk1.7 + to run tomcat 8, if you are using jdk1.6, you need tomcat 7-.
See this: http://tomcat.apache.org/whichversion.html
This make me remember back in collage, it took me 2 days to finish jdk/tomcat hello world, :) , what a good time it is.
Just make sure, open a command line, input java --version to check whether you jdk is configured well, and which version it is in use. Just to be sure, in some case you need to re-login or reboot to make your new configured jdk work.
Believe me, if you configured jdk well, you don't need to change anything of the tomcat, just unzip it, and start it, it would work, unless the port 8080 is already taken.
Go to the installation folder of apache tomcat in your case as you said its
C:\Program Files (x86)\apache-tomcat-8.0.9\bin and double click the startup.bat
Then go to web browser and type http://localhost:8080 that should do the work
Set up CATALINE_HOME = your tomcat Location
JAVA_HOME = your java (Version 6 or Seven).
Path = Same JAVA_HOME Java version path til bin.
At final run the startup.bat

Error when starting Datomic shell: java.lang.NoClassDefFoundError: jline/ConsoleRunner

I followed the instructions on the Datomic site: http://docs.datomic.com/getting-started.html, but I'm getting this error when trying to start up the datomic shell prompt. I'm using a windows machine. Any suggestions? I tried the same thing on my linux box and did not get this error.
Edit: moved to a different windows machine and it's working. If I have time to troubleshoot this problem and I find a solution I'll report back
I noticed that you cannot run the shell.cmd from within the bin directory, you need to call it with bin\shell.cmd from the parent directory... hope that helps.
In case you are using cygwin/bash and call bin/shell :
The java runtime on windows does not understand classpath with a ":"
but this is what you get from bin/classpath.
Either correct this or use DOS-CMD shell and call bin/shell.cmd inside.
Regards
Some tips for running datomic on Windows (7 at least):
Do not download datomic into Program Files. On startup, it creates logging directories and temp files into its own directories, so unless you run the command prompt as Administrator, you're gonna have screens full of Unable to write to file... errors.
You need to run datomic as such (assuming you extracted the download to C:)
c:\datomic-free-0.x.xxxx>bin\shell.cmd
Note the backslash. Tripped me up forever coming from *nix world.
After that, return to your regularly scheduled datomic tutorials.

Categories