If you installed the SDK when you installed Android Studio, you can find the location in the Android Studio SDK Manager. To open the SDK Manager from Android Studio, click Tools > Android > SDK Manager or click SDK Manager in the toolbar.
It's /usr/local/java/jdk[version] However, if you actually go look there, you'll see there are multiple directories and symbolic links placed there by the package system to simplify future maintenance. The actual directory is java-11-openjdk-amd64 , with another symlink of default-java .
WAY-1 : Updated for the shortest and easy way
Below command will give you the path, But it will only work if java command is working in other words if java path is configured.
readlink -f $(which java)
Read more at Where can I find the Java SDK in Linux?
WAY-2 (Better than WAY-1) : Below answer is still working and try it if above command is not working for you.
You need to dig into symbolic links. Below is steps to get Java directory
Step 1:
$ whereis java
java: /usr/bin/java /etc/java /usr/share/java
That tells the command java resides in /usr/bin/java.
Dig again:
Step 2:
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2009-01-15 18:34 /usr/bin/java -> /etc/alternatives/java
So, now we know that /usr/bin/java
is actually a symbolic link to /etc/alternatives/java
.
Dig deeper using the same method above:
Step 3:
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 31 2009-01-15 18:34 /etc/alternatives/java -> /usr/local/jre1.6.0_07/bin/java
So, thats the actual location of java: /usr/local/jre.....
You could still dig deeper to find other symbolic links.
Reference : where is java's home dir?
Please use this command:
readlink -f $(which java)
It works for me with Ubuntu gnome.
On my computer the result is:
/usr/lib/jvm/java-7-oracle/jre/bin/java
Regards.
In generally, java gets installed at /usr/lib/jvm . That is where my sun jdk is installed. check if it is same for open jdk also.
$whereis java
java: /usr/bin/java /usr/bin/X11/java /usr/share/java /usr/share/man/man1/java.1.gz
$cd /usr/bin
$ls -l java
lrwxrwxrwx 1 root root 22 Apr 15 2014 java -> /etc/alternatives/java
$ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 39 Apr 15 2014 /etc/alternatives/java -> /usr/lib/jvm/java-7-oracle/jre/bin/java
So,JDK's real location is /usr/lib/jvm/java-7-oracle/
Location of JRE in Ubuntu:
/usr/lib/jvm/java-7-oracle/jre
$ whereis java
java: /usr/bin/java /usr/lib/java /usr/bin/X11/java /usr/share/java /usr/share/man/man1/java.1.gz
On Ubuntu 14.04, it is in /usr/lib/jvm/default-java
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With