Get path to java.exe [duplicate] - java

This question already has answers here:
Find absolute java.exe path programmatically from java code
(5 answers)
Closed 9 years ago.
I need help with getting path to java.exe. But I need it to do with java code. And I want it to work on Linux and Mac and on other systems too, so there won't be java.exe, I don't know what's there.
Does anyone know how to do it? Thanks.

Take a look at this post. Get path to the JRE
It explains how to get the path of where your java.exe bin/java file lies on your OS.
Also see the docs for more properties that are available
Java System.getProperty docs

Related

run-nifi.bat : The JAVA_HOME environment variable is not defined correctly [duplicate]

This question already has answers here:
How to set java_home on Windows 7?
(18 answers)
Closed 4 years ago.
I have developed a JAVA application for signature verification and I want to develop an Apache Nifi Processor for this JAVA application.
When I want to run .bat file in cmd i.e. run-nifi.bat I get this error :
"The JAVA_HOME environment variable is not defined correctly. Instead
the PATH will be used to find the java executable."
Also I can not find my processor at http://localhost:8080/nifi
Just define JAVA_HOME system environment variable and point it to your JDK dir. More detailed answer: How to set java_home on Windows 7?

JAVA_HOME variable not setting in Windows [duplicate]

This question already has answers here:
How to set java_home on Windows 7?
(18 answers)
Closed 5 years ago.
I've downloaded jdk9 and Java is installed in the following location.
C:\Program Files\Java\jdk-9
and I'm trying to set up the JAVA_HOME variable under environment variables.
I've created a system variable
And I checked JAVA_HOME variable value in command as
But still it doesnt show the path of it. I've followed the other questions about this in stack. But nothing helped me. Any ideas would be greatly appreciated.
I restarted command prompt and it show me as below

How to use environment variables in eclipse.ini? [duplicate]

This question already has answers here:
Environment variables in eclipse.ini file
(3 answers)
Closed 4 years ago.
Is it possible to use environment variables like %JAVA_HOME% within eclipse.ini?
I'd like to include the following without having to hardcode the absolute path to jdk:
-vm
%JAVA_HOME%\bin\javaw.exe
But that's not working and eclipse complains about missing jdk.
By the way: cmd echo %JAVA_HOME% shows the correct path.
It is not possible. There is already a bug opened for this.
Also see this question: eclipse.ini variables

Find the java.exe location from java [duplicate]

This question already has answers here:
Get path to java JRE
(3 answers)
Closed 9 years ago.
I am wondering if there is a way, from java, to find the location of the java.exe running the program?
My use case is that I am trying to have Java execute a batch script that needs JAVA_HOME to be set in the local environment. The environment that I am executing this on may not have JAVA_HOME set or even the java executable on the path, but I would assume that the JVM knows where its executable is located.
System.getProperty("java.home");
is one option. Which shows the following directory in my machine:
C:\Program Files\Java\jdk1.7.0_02\jre
Most important system properties are listed here.
The java.home property will supply the path to the currently running JRE, regardless of what is installed, or what JAVA_HOME is. See the Oracle documentation here.
System.getProperty("java.home");

How to start extracted eclipse [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Cannot run Eclipse; JVM terminated. Exit code=13
I downloaded Eclipse eclipse-jee-galileo-SR2-win32 in zip format then I extract the same on my harddisk.
So when I clicked on eclipse.exe I am getting following window as alert.
Though I have java 1.6_35 installed on my machine.
After googling a lot so far I am unable to rid on this.
how to start eclipse now.
same is working fine on other machine.
Check your eclipse.ini file (in the same folder as the exe). Maybe it does not point to the location where your java is installed.
Search for a line like this
-vm c:/Program Files/Java/jdk1.6.0_22/bin/javaw.exe
Make sure if your jvm is 32 bit.
you can find by running
java -version .
you have eclipse for 32-bit jvm (-arch x86).

Categories