How to find out the path of installed JDK

shalini_goel14
@shalini-goel14-ASmC2J โ€ข Oct 26, 2024

A long time back a here asked this question in a very informal way(I mean not in any thread) and he didn't even tried to share its answer also.Well, just now I was trying something and got its answer:

In windows:

Step1: Open command prompt
Step2: Simply type following command

C:\Documents and Settings\shalinig>echo %JAVA_HOME%

It will simply display the path of directory where jdk is installed on your system.

If anyone knows about the command used on Linux. Please share here. ๐Ÿ˜€

Thanks

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • komputergeek

    @komputergeek-Yf5hJ4 • Feb 27, 2009

    In ubuntu we can use whereis command

    whereis java

    But with this we get different paths,corresponding to different files.So instead of this command it is better to use :

    whereis javac
    OR
    locate javac
  • Raviteja.g

    @ravitejag-02nJVr • Feb 27, 2009

    shalini_goel14A long time back a here asked this question in a very informal way(I mean not in any thread) and he didn't even tried to share its answer also.Well, just now I was trying something and got its answer:

    In windows:

    Step1: Open command prompt
    Step2: Simply type following command
    It will simply display the path of directory where jdk is installed on your system.

    If anyone knows about the command used on Linux. Please share here. ๐Ÿ˜€

    Thanks

    what will it display if there is no jdk installed in our system
    answer with patience for my silly question ๐Ÿ˜‰

  • shalini_goel14

    @shalini-goel14-ASmC2J • Feb 27, 2009

    A very good question Raviteja, echo command will work as a normal command so I guess it will print %JAVA_HOME% only in output instead of any path. ๐Ÿ˜€

    Please try it on your system and confirm it because on my system JDK is already installed.

    Hope I have answered you. Please correct me if I am wrong.๐Ÿ˜€

  • Yamini L

    @yamini-uMEVDQ • Feb 27, 2009

    In my system,jdk is already installed..But i am not getting the path..It just prints %JAVA_HOME% in the output instead of path๐Ÿ˜•....Why is that so??

  • shalini_goel14

    @shalini-goel14-ASmC2J • Feb 27, 2009

    miniyIn my system,jdk is already installed..But i am not getting the path..It just prints %JAVA_HOME% in the output instead of path๐Ÿ˜•....Why is that so??

    I guess you have not added JAVA_HOME variable in Environment variables. Please add it

    e.g. JAVA_HOME = C:\Program Files\Java\jdk1.6.0_02\bin in My Computer Properties->Advanced Settings->Environment Variables window.
    Then try that command.

    By the way, is Java working on your system. I mean any java program is working fine?

  • Yamini L

    @yamini-uMEVDQ • Feb 27, 2009

    Java programs are working..Previously i had done so many.So no problem with that..As you said,JAVA_HOME variable has not been added in that Environmental Variables list..I followed your instructions,added that and now its fine..

    Thanks for clearing my doubt..:smile:

  • Raviteja.g

    @ravitejag-02nJVr • Feb 27, 2009

    yes in my system jdk is installed but the environment vaiable is path so at first it prints %java_home%
    but now it works
    but what about in linux......

  • hitesh2008

    @hitesh2008-2rnvXM • Apr 5, 2011

    Thanks sir i also wanted to know this