How to know the JVM path in a Linux system?

5

3

I want to copy some files in the subdirectories of the JVM path , java is already installed. How to know the JVM's path ?

Andy Frédéric ANDRIANIAINA

Posted 2011-11-14T11:06:45.797

Reputation: 171

Answers

7

locate java

This will give you the location of java installation in your system.

Most probably it would be:

/usr/lib/java/

Vineet Menon

Posted 2011-11-14T11:06:45.797

Reputation: 698

11

Check your $JAVA_HOME environment variable from a terminal:

echo $JAVA_HOME

Nathan Friend

Posted 2011-11-14T11:06:45.797

Reputation: 211

1This is what I am trying to set using the located path :) – milosmns – 2017-12-09T00:37:59.580

5

In linux you can use the whereis and which shell commands.

which java
whereis java

which will give you the jre path in /usr/bin folder which will be /usr/bin/java most probably. This is not the actual jre file but it's just a symbolic link to the actual jre file which is located else where. To know the actual jre path you will have to write

readlink -f /usr/bin/java

or whatever was the path of jre returned by which/whereis command.

hassan_ashraf

Posted 2011-11-14T11:06:45.797

Reputation: 51

This is the only thing that works. – milosmns – 2017-12-09T00:39:13.040

-3

which java 

This is the simplest command and gives the exact path.

Vetriselvan M

Posted 2011-11-14T11:06:45.797

Reputation: 1

This answer is not correct because it shows the path of the java binary, which will most likely be /usr/bin/java or something of that sort, which is different from the actual path of the JRE. – oldmud0 – 2017-01-19T00:17:40.843