How do I find where JDK is installed on my windows machine?
If you are using Linux/Unix/Mac OS X:
Try this:
$ which java
Should output the exact location.
After that, you can set JAVA_HOME
environment variable yourself.
In my computer (Mac OS X - Snow Leopard):
$ which java
/usr/bin/java
$ ls -l /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Nov 7 07:59 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
If you are using Windows:
c:\> for %i in (java.exe) do @echo. %~$PATH:i
How to know the jdk version on my machine?
you might need to add path
in environment variables which you can find in Control Panel
open the Jdk where you installed and add until /bin
in the path in environment variables.
Add until /bin
in path variable in System Variables which is residing in Environment Variables.
Then do java -version
which might show up.
If still problem persists, try restarting your pc and see.
How to locate my java jdk folder and edit the path variable - integration maven
Go to
Start->Control Panel->System->Advanced System Settings->Environment Variable->user variables
Click on new button
give the
variable name : JAVA_HOME
variable value: C:\Program Files\Java\jdk1.6.0_32
in that way you setup your java home and try
Also make sure to take new command prompt after you did any changes in environment variables
Where does Windows keep JDK location reference?
How is Windows deciding what JDK to use?
Windows is NOT making decisions on its own. If you get version 10 information when you run java -version
, it is because Windows is finding the folder containing java.exe
corresponding to the version 10 first in the paths pointed to by the PATH environment variable. If you have installed Java using an installer, the installer would update the PATH variable for you. Check your PATH variable and you will see the Java 10 folder appearing there first and then Java 7 folder.
How to tell if JRE or JDK is installed
You can open up terminal and simply type
java -version // this will check your jre version
javac -version // this will check your java compiler version if you installed
this should show you the version of java installed on the system (assuming that you have set the path of the java in system environment).
And if you haven't, add it via
export JAVA_HOME=/path/to/java/jdk1.x
and if you unsure if you have java at all on your system just use find
in terminal
i.e. find / -name "java"
Where is the Java SDK folder in my computer? Ubuntu 12.04
WAY-1 : Updated for the shortest and easy way
Below command will give you the path, But it will only work if java command is working in other words if java path is configured.
readlink -f $(which java)
Read more at Where can I find the Java SDK in Linux?
WAY-2 (Better than WAY-1) : Below answer is still working and try it if above command is not working
for you.
You need to dig into symbolic links. Below is steps to get Java directory
Step 1:
$ whereis java
java: /usr/bin/java /etc/java /usr/share/java
That tells the command java resides in /usr/bin/java.
Dig again:
Step 2:
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2009-01-15 18:34 /usr/bin/java -> /etc/alternatives/java
So, now we know that /usr/bin/java
is actually a symbolic link to /etc/alternatives/java
.
Dig deeper using the same method above:
Step 3:
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 31 2009-01-15 18:34 /etc/alternatives/java -> /usr/local/jre1.6.0_07/bin/java
So, thats the actual location of java: /usr/local/jre.....
You could still dig deeper to find other symbolic links.
Reference : where is java's home dir?
How do I find the path to the JDK downloaded on my mac?
/Library/Java/JavaVirtualMachines
Related Topics
How to Speed Up the Gwt Compiler
How to Override and Overload Static Methods in Java
Differencebetween I++ & ++I in a for Loop
Possible Heap Pollution via Varargs Parameter
Disable a Particular Checkstyle Rule for a Particular Line of Code
When to Use Entitymanager.Find() VS Entitymanager.Getreference() with JPA
Selenium Switch Focus to Tab, Which Opened After Clicking Link
Differencebetween @Inject and @Autowired in Spring Framework? Which One to Use Under What Condition
Run a Single Test Method with Maven
Building Executable Jar with Maven
Should I Declare Jackson's Objectmapper as a Static Field
Fastest Way to Iterate Over All the Chars in a String
Can a Constructor in Java Be Private
Retrieve Version from Maven Pom.Xml in Code
Looking for an Example for Inserting Content into the Response Using a Servlet Filter