8

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

4 Answers 4

8
locate java

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

Most probably it would be:

/usr/lib/java/
12

Check your $JAVA_HOME environment variable from a terminal:

echo $JAVA_HOME
1
  • 3
    This is what I am trying to set using the located path :)
    – milosmns
    Dec 9, 2017 at 0:37
11

In Linux you can use the whereis and which shell commands:

$ which java
$ whereis java

which will give you, most likely, the JRE path in /usr/bin folder such as /usr/bin/java.

This is not the actual JRE file, but a symbolic link to the actual JRE file (which is located elsewhere). To get the actual JRE path you have to follow that link

$ readlink -f /usr/bin/java

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

1
  • This is the only thing that works.
    – milosmns
    Dec 9, 2017 at 0:39
-2
which java 

This is the simplest command and gives the exact path.

1
  • 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
    Jan 19, 2017 at 0:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .