Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find where JDK is installed on my windows machine?

Tags:

java

windows

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).

like image 310
Ashine Avatar asked Jan 13 '11 14:01

Ashine


People also ask

How do I know where my JDK is installed?

Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and in system variable try to find JAVA_HOME. This gives me the jdk folder.

How do I know if I have JDK installed on Windows?

Normally a jdk installation has javac in the environment path variables ... so if you check for javac in the path, that's pretty much a good indicator that you have a jdk installed.


2 Answers

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 
like image 188
Pablo Santa Cruz Avatar answered Oct 03 '22 07:10

Pablo Santa Cruz


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

like image 31
grokster Avatar answered Oct 03 '22 08:10

grokster