Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (3.9k points)
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).

1 Answer

0 votes
by (46k points)

If you are handling Linux/Unix/Mac OS X:

Examine this:

$ which java

Should output the correct position.

After that, you can fix the JAVA_HOME environment variable yourself.

In my PC (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 working on Windows:

c:\> for %i in (java.exe) do @echo.   %~$PATH:i

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 10, 2019 in Java by Krishna (2.6k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...