How do I find where JDK is installed on my windows machine?
How do I find where JDK is installed on my windows machine?
Question
I need to know where JDK is located on my machine.
On running Java -version
in cmd, it shows the version as '1.6.xx'.
To find the location of this SDK on my machine I tried using echo %JAVA_HOME%
but it is only showing 'JAVA_HOME' (as there is no 'JAVA_PATH' var set in my environment variables).
Accepted Answer
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
Read more… Read less…
Windows > Start > cmd >
C:> for %i in (javac.exe) do @echo. %~$PATH:i
If you have a JDK installed, the Path is displayed,
for example: C:\Program Files\Java\jdk1.6.0_30\bin\javac.exe
In windows the default is: C:\Program Files\Java\jdk1.6.0_14
(where the numbers may differ, as they're the version).
Java installer puts several files into %WinDir%\System32 folder (java.exe, javaws.exe and some others). When you type java.exe in command line or create process without full path, Windows runs these as last resort if they are missing in %PATH% folders.
You can lookup all versions of Java installed in registry. Take a look at HKLM\SOFTWARE\JavaSoft\Java Runtime Environment and HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment for 32-bit java on 64 bit Windows.
This is how java itself finds out different versions installed. And this is why both 32-bit and 64-bit version can co-exist and works fine without interfering.