Where can I find the Java SDK in Linux after installing it?
This depends a bit from your package system ... if the java
command works, you can type readlink -f $(which java)
to find the location of the java command. On the OpenSUSE system I'm on now it returns /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java
(but this is not a system which uses apt-get
).
On Ubuntu, it looks like it is in /usr/lib/jvm/java-6-openjdk/
for OpenJDK, and in some other subdirectory of /usr/lib/jvm/
for Suns JDK (and other implementations as well, I think).
Debian is the same.
For any given package you can determine what files it installs and where it installs them by querying dpkg. For example for the package 'openjdk-6-jdk': dpkg -L openjdk-6-jdk
Where is the Java SDK folder in my computer? Ubuntu 12.04
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?
How to install the JDK on Ubuntu Linux
Referring to Ask Ubuntu question How to set JAVA_HOME for OpenJDK?,
How to install Open JDK
(Java developement kit) in Ubuntu (Linux)?
Open Terminal from Application Dash or press Ctrl+Alt+T
Update repository:
sudo add-apt-repository ppa:openjdk-r/ppa # only Ubuntu 17.4 and earlier
sudo apt updateOptional: To search available distributions of
openjdk
, use the following command:apt search openjdk
Install the appropriate version with the following command:
sudo apt install openjdk-8-jdk
sudo apt install openjdk-8-source #this is optional, the jdk source codeFor
JAVA_HOME
(Environment Variable) type command as shown below, in "Terminal" using your installation path...export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
(Note:
/usr/lib/jvm/java-8-openjdk
is symbolically used here just for demostration. You should use your path as per your installation.)For
PATH
(Environment Variable) type command as shown below, inTerminal
:export PATH=$PATH:$JAVA_HOME/bin
To check your installation:
java -version
How do I find where JDK is installed on my windows machine?
If you are using Linux/Unix/Mac OS X:
Try this:
$ which java
Should output the exact location.
After that, you can set JAVA_HOME
environment variable yourself.
In my computer (Mac OS X - Snow Leopard):
$ which java
/usr/bin/java
$ ls -l /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Nov 7 07:59 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
If you are using Windows:
c:\> for %i in (java.exe) do @echo. %~$PATH:i
What's the correct way of installing jdk on linux
You can install and stay up to date with the latest Oracle Java 7 and all you have to do is manually add the PPA repository to the Software Sources.
From http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html:
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit
For Ubuntu, http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html. With this, I've managed to installed JDK on my ubuntu server.
How to find JDK directory in Ubuntu for JNI C/C++ library
Assuming you've got a JDK installed the directory should be something like: /usr/lib/jvm/java-7-openjdk-amd64
(assuming OpenJDK 7 here). You might also need to a JAVA_HOME
environment variable pointing at the same directory depending on your build process.
If you haven't got a JDK installed you can install the OpenJDK with something like the following in a terminal windows:
sudo apt-get install openjdk-7-jdk
How to get java path in CentOS?
Here are the solution
# cd /opt/jdk1.7.0_79/
# alternatives --install /usr/bin/java java /opt/jdk1.7.0_79/bin/java 2
# alternatives --config java
# alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_79/bin/jar 2
# alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_79/bin/javac 2
# alternatives --set jar /opt/jdk1.7.0_79/bin/jar
# alternatives --set javac /opt/jdk1.7.0_79/bin/javac
# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
# export JAVA_HOME=/opt/jdk1.7.0_79
# export PATH=$PATH:/opt/jdk1.7.0_79/bin
Thanks to tecadmin
The full pathname of a JDK installation for Oracle SQL Developer
For me it was similar error. I solved it simply by inserting
SetJavaHome /usr/lib/jvm/java-7-openjdk-amd64/
into ~/.sqldeveloper/4.0.0/product.conf file.
Related Topics
How to Create a Link to a Directory
How to Increase Ble Advertisement Frequency in Bluez
How to Pass a Wildcard Parameter to a Bash File
How to Get the Start Time of a Long-Running Linux Process
Linux Bash Script to Extract Ip Address
Why Linux/Gnu Linker Chose Address 0X400000
Need to Remove the Count from the Output When Using "Uniq -C" Command
Command to Change the Default Home Directory of a User
Restarting Cron After Changing Crontab File
How Find Out Which Process Is Using a File in Linux
Docker-Compose Up and User Inputs on Stdin
Count Number of Files Within a Directory in Linux
Start Script After Another One (Already Running) Finishes
What Is Global _Start in Assembly Language