[java] Where is the Java SDK folder in my computer? Ubuntu 12.04

I know it's installed because when I type:

$java -version

I get:

OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

And when I type:

$locate jdk

I get:

/home/arturo/Documents/2012a/sys/java/jre/glnxa64/jre/lib/servicetag/jdk_header.png
/usr/share/app-install/desktop/openjdk-6-jre:openjdk-6-java.desktop
/usr/share/app-install/desktop/openjdk-7-jre:openjdk-7-java.desktop
/usr/share/app-install/icons/openjdk-6.png
/usr/share/app-install/icons/openjdk-7.png

What worries me about the first item in the list is that the 2012a folder is my MATLAB folder and not a standard 'usr/lib' folder. I'm really confused on where the JDK and JRE got installed, because I need to set the $JAVA_HOME path pointing to the folder. Where am I missing something?

This question is related to java java-home

The answer is


I am using Ubuntu 18.04.1 LTS. In my case I had to open the file:

/home/[username]/netbeans-8.2/etc/netbeans.conf

And change the jdk location to:

netbeans_jdkhome="/opt/jdk/jdk1.8.0_152"

Then saved the file and re-run Netbeans. It worked for me.


For me, on Ubuntu, the various versions of JDK were in /usr/lib/jvm.


On Ubuntu 14.04, it is in /usr/lib/jvm/default-java.


I found the solution to this with path name: /usr/lib/jvm/java-8-oracle

I'm on mint 18.1


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/


$ whereis java

java: /usr/bin/java /usr/lib/java /usr/bin/X11/java /usr/share/java /usr/share/man/man1/java.1.gz


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.


you can simply write the following command in the terminal of your linux system and get the java path :- echo $JAVA_HOME


Location of JRE in Ubuntu:

/usr/lib/jvm/java-7-oracle/jre