Could not find JAVA home Elastcisearch - elasticsearch

I installed Elasticsearch 6.2,Kibanaandlogstash.
I created a file in bin\elasticsearch\launchELK.cmd, that contain just 2 lines:
set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_161"
elasticsearch.bat
I added on a system variable a JAVA_HOME.
When I write java -version:
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
When I write echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_161
And finally when I run elasticsearch by the file launchELK.cmd, this is the rsult:
bin> lancerELK.cmd
bin> set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_161"
bin> elasticsearch.bat
Le chemin d'accès spécifié est introuvable
could not find java; set JAVA_HOME or ensure java is in PATH
Someone can help me please ?
Thank you

Try setting the JAVA_HOME variable in elasticsearch.bat file then try to start elasticsearch.

Related

Cassandra - Improperly specified VM option 'ThreadPriorityPolicy=42'

During single node installation when I am trying to see the nodetool status, this below error message is coming:
ubuntu#ip-172-31-6-128:~/apache-cassandra-3.11.4/bin$ ./cassandra -R
ubuntu#ip-172-31-6-128:~/apache-cassandra-3.11.4/bin$ [0.000s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:./../logs/gc.log instead.
intx ThreadPriorityPolicy=42 is outside the allowed range [ 0 ... 1 ]
Improperly specified VM option 'ThreadPriorityPolicy=42'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
This is happening because ThreadPriorityPolicy is not a valid JVM option in whichever version of Java you are using. You can see this by checking the version from the command prompt:
$ java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (IcedTea 3.17.1) (Alpine 8.275.01-r0)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
Note that Cassandra 3.x will only function with Java 8. You are likely seeing this error, because the Java 8 options specified in cassandra-env.sh are not valid with your version of Java. Install the latest Java 8, or run Cassandra with Docker.
Edit:
Based on this: Cassandra start error with ThreadPriorityPolicy=42
Try setting ThreadPriorityPolicy=1.

Jasperserver 6.3.0 (Tomcat 8.0.14) startup.bat: Unrecognized option: --JvmMs

As mentioned in the question:
Why can't I start it out of my tomcat\bin dir?
> apache-tomcat\bin\startup.bat
Unrecognized option: --JvmMs
> java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
(It works running it as a service though, there it's started differently: C:\JASPER~1\JASPER~1.0\APACHE~1\bin\tomcat8.exe //RS//jasperreportsTomcat)
(I did not set it up though)
Outcommenting (via rem) the following line in apache-tomcat\bin\setenv.bat did the job:
rem set JAVA_OPTS= --JvmMs 1024 --JvmMx 2048 --JvmSs 2 %JAVA_OPTS%
Since I use it as a test instance, I don't care about the JVM memory settings too much here, but maybe somebody knows the cause and a more appropriate solution?

I am unable to set up env variables in my machine

What are the steps setting up env variables in my machine?
I used path
Java_Home:C:\Program Files\Java\jdk1.8.0_181;
Path :C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\Java\jre1.8.0_181\bin;C:\Program Files\Maven\apache-maven-3.6.0-bin\apache-maven-3.6.0\bin
Maven_Home:C:\Program Files\Maven\apache-maven-3.6.0-bin\apache-maven-3.6.0C:\Program Files\Maven\apache-maven-3.6.0-bin\apache-maven-3.6.0
C:\Users\user 2>java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) Client VM (build 25.181-b13, mixed mode)
C:\Users\user 2>mvn --version
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
'cmd' is not recognized as an internal or external command,
operable program or batch file.
Your JAVA HOME should be
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_181
Your MAVEN HOME should be
MAVEN_HOME= D:\Software\apache-maven-3.6.0
Append path variable with following entry
Path :%JAVA_HOME%\bin;%MAVEN_HOME%\bin;

Error in sonar startup, Unable to start JVM: No such file or directory (2)

I am facing strange issue with sonarqube 5.0.1 , one one of the machine it is not starting. Here is the error log - sonar.log -
--> Wrapper Started as Daemon
Launching a JVM...
Unable to start JVM: No such file or directory (2)
JVM exited while loading the application.
JVM Restarts disabled. Shutting down.
<-- Wrapper Stopped
Machine is x86_64 GNU/Linux - Centos 5.1.
this box has java installed -
$java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
The same sonarqube package works on another machine.
Any idea what could be the issue here?
Thanks.
Issue was in the wrapper.conf where the java wrapper command was not getting resolved. It worked if I give the absolute path - ‘wrapper.java.command=/path/to/my/jdk/bin/java’
This could be an issue with an environment on a host.. not sure.
Few things that helped me in troubleshooting this -
log level changed to DEBUG in wrapper.conf
comments given in the wrapper.conf!
Thanks all for chiming in! Appreciate your inputs.
1.Just close all running jvm from task manager
2. Change the port of the sonar runner from the properties
I had the same symptoms (wrapper starts then immediately stops).
I tried these steps and finally succeeded (on a windows 10 pc):
1) in wrapper.conf, specified the java command:
wrapper.java.command=C:\Program Files\Java\jdk1.7...\bin\java.exe
That did not help.
2) Finally this fixed the problem. In the windows Services, open the Sonar service and then open Log On tab.
Changed the Log On to myself as follows:
I was facing the same issue on sonar startup. After reading this post , i modified the JDK path in below file and it works.
Modify the JDK path in wrapper.conf
wrapper.java.command=%JAVA_HOME%/bin/java
Install jdk 11
sudo yum install java-11-openjdk -y
sudo alternatives --config java
Select the JDK 11 version
Set the JDK 11 version in wrapper.conf
vi /opt/sonar/conf/wrapper.conf
wrapper.java.command=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-3.el8_5.x86_64/bin/java
Could you verify the Java version on the machine starting?
Java 6 is no more supported http://docs.sonarqube.org/display/SONAR/Requirements#Requirements-Prerequisite but from your error message, I don't know if this is the problem you meet.
Solution 1
Set java path globally
Solution 2
Go to sonarqube-{version}/conf directory
Edit wrapper.conf file
Replace wrapper.java.command=java with wrapper.java.command= {path-to-your-java-bin-directory}/java
eg: wrapper.java.command=/usr/java/bin/java
Try using a relative path, if your Sonar Folder is located in the same root folder as your jdk. For me my sonar and jdk are both under "Program Files", which has restrictive permission, hence the error.
E.g:
wrapper.java.command=../../../Java/jdk-11.0.4/bin/java

Doesn't work macros for environment variables in Windows 7

I have set JAVA_HOME variable
And also I have set path variable:
C:\>set java_home
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_38
C:\>set path
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\To
rtoiseSVN\bin;%JAVA_HOME%\bin;C:\Program Files\apach\apache-maven-3.2.3\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\>
At this way java is not recognized.
Lets change a bit(replace %JAVA_HOME%\bin with C:\Program Files\Java\jdk1.6.0_38\bin):
C:\>set java_home
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_38
C:\>set path
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\To
rtoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_38\bin;C:\Program Files\apach\apache-maven-3.2.3\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
C:\>java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
For this way it is working good.
What do I wrong?
"%JAVA_HOME%\bin" is a perfectly valid directory name. cmd would need to evaluate its value before it could be used.
call set path=%path%
should work for you.
Expansion
path is loaded with the system value, then merged with the 'user' value, when any %var% in the path is replaced by its then-current value. If you add another %var% into the path (like for instance, as a "user" variable) then you need to re-evaluate to resolve the value.
The upshot is: set the path as a system variable, not a user variable if it contains a value to be resolved.

Resources