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

Answer from Paŭlo Ebermann on Stack Overflow
Discussions

Where is Java/the JDK installed on Linux?
Both rpm and dpkg systems typically use the "alternatives" system to support multiple installs of packages like java, so you can find yours like so: $ which java /usr/bin/java $ ls -l /usr/bin/java lrwxrwxrwx. 1 root root 22 Jan 29 15:08 /usr/bin/java -> /etc/alternatives/java* $ ls -l /etc/alternatives/java lrwxrwxrwx. 1 root root 72 Jan 29 15:08 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b13-0.fc29.x86_64/jre/bin/java* My install of Java is in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b13-0.fc29.x86_64 More on reddit.com
🌐 r/linux4noobs
9
6
February 16, 2019
Setting up Fedora 32 to use the latest Java version in development environments.

You set JAVA_HOME and etc in IntelliJ, not from shell.

More on reddit.com
🌐 r/Fedora
4
5
September 25, 2020
"Unable to locate the Java runtime" error on launch. Will give gold.
Might want to try reinstalling the launcher, since it's looking for that file in the wrong location. By default, that file is supposed to be in; C:\Program Files (x86)\Minecraft\runtime\jre-x64\1.8.0_25\bin I'm not entirely sure if this is actually the cause of your issue, but it's worth a shot at least. When the launcher asks you which directory you want to install it to, just leave it as the default. More on reddit.com
🌐 r/Minecraft
14
4
March 10, 2017
Is there a way to hide the dir path in terminal?
Oh-my-posh similar to oh-my-zsh for Linux very customizable. More on reddit.com
🌐 r/vscode
11
45
October 11, 2020
🌐
Scaler
scaler.com › home › topics › how to find java sdk path in linux?
How to Find Java SDK Path in Linux? - Scaler Topics
December 31, 2023 - However, a common location for the JDK installation directory is /usr/lib/jvm/. You will find separate folders for different JDK versions installed on your system within this directory.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check java version installed on linux
How to Check Java Version Installed on Linux
December 11, 2025 - The system returns the path to the Java installation. Use the path to check the Java version: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -version · Alternatively, use the whereis command and follow the symbolic links to find the Java path.
🌐
Medium
medium.com › @nirbhaysingh281 › check-java-installation-path-on-linux-server-and-add-in-jenkins-d3e6e2b80795
Check java installation path on Linux server, and add in Jenkins | by Nirbhay Singh | Medium
April 17, 2023 - In the JAVA_HOME field, enter the path to the Java installation directory. In this example, it is /usr. Click on the Save button to save the configuration. Now that you have added the Java installation to Jenkins, you can use it in your build jobs. ... Technophile, Assistant Vice President at CITI, talks about DevOps, Cloud, SRE, Linux and Programming.
Find elsewhere
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
Java path - Linux Mint Forums
August 13, 2011 - Use locate <name> in a terminal to find the path · Top · Habitual · Post by Habitual » Sun Aug 14, 2011 10:20 am · /usr/lib/jvm/java-6-openjdk/jre · Top · brendangaturu · Post by brendangaturu » Fri Jan 10, 2020 5:09 am · I am using Linux mint 19.3 and i found Java in usr/lib/jvm ·
🌐
Oracle
java.com › en › download › help › path.html
How do I set or change the PATH system variable?
To find out if the path is properly set: In a terminal windows, enter: % java -version This will print the version of the java tool, if it can find it. If the version is old or you get the error java: Command not found then the path is not properly set. Determine which java executable is the ...
🌐
TutorialsPoint
tutorialspoint.com › article › find-the-java-sdk-location-on-linux
Find the Java SDK location on Linux
March 17, 2026 - Combine which and readlink commands to resolve symbolic links and find the actual Java installation: readlink -f $(which java) readlink -f $(which javac) The -f option follows all symbolic links recursively, revealing the final destination: /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-check-java-version-in-linux
How to Check Java Version in Linux - GeeksforGeeks
December 26, 2024 - It responds with the path where Java is installed, now use the path to check the java version in linux: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -version · This enables you to check the java version. ... Here is another way to know your java version in linux with the help of installed java pacakages, run the below command: ... You will find all your installed packages, these are a lot right?
🌐
IBM
ibm.com › docs › en › db2 › 11.5.x
Specifying JDK for Java routine development (Linux and ...
To build and run Java routine code, you must set the JDK_PATH database manager configuration parameter to the Java Development Kit (JDK) installation path on the database server.
🌐
Oracle
docs.oracle.com › cd › E19062-01 › sun.mgmt.ctr36 › 819-5418 › gaznb › index.html
To Set PATH on Linux (Sun Management Center 3.6.1 Installation and Configuration Guide)
Previous: To Set PATH on Microsoft Windows NT or Microsoft Windows 2000 ... Change to your home directory. ... Open the .bashrc file. Add the following line to the file. Replace the JDK directory with the name of your java installation directory. ... Save the file and exit. Use the source command to force Linux to reload the .bashrc file which normally is read only when you log in each time.
🌐
Oracle
docs.oracle.com › cd › E19215-01 › 820-2215 › gaznb › index.html
To Set PATH on Linux
Replace the JDK-directory with the name of your Java installation directory. ... Save the file and exit. Use the source command to force Linux to reload the .bashrc file which normally is read only when you log in each time. ... Note that if you wish to set the PATH for all users, you need to log in as root in the bash shell and perform the above steps on the .profile file in the etc directory and not the .bashrc file in the home directory.
🌐
YouTube
youtube.com › sagar s
How to find where java is installed in Arch Linux - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published   April 27, 2016
Views   941
🌐
wikiHow
wikihow.tech › computers and electronics › operating systems › linux › ubuntu › how to set up your java_home path in ubuntu: 10 steps
How to Set Up Your Java_Home Path in Ubuntu: 10 Steps
July 26, 2025 - 5. Type "locate openjdk" and press Enter to find the Java installation location. 6. Type "export JAVA_HOME=" followed by the Java installation location in the terminal and press Enter.
🌐
Medium
sharansumitkumar.medium.com › how-to-find-java-path-in-linux-ad1ed5798d19
How to find Java Path in linux - Sumit Kumar Sharan - Medium
January 6, 2022 - Sign in · Sumit Kumar Sharan· · Follow · Jun 15, 2021 · -- Listen · Share · Just Paste the following line and you are good to go · dirname $(dirname $(readlink -f $(which javac))) Java · Java11 · Java8 · Follow · 6 Followers · ·4 ...
🌐
Just Academy
justacademy.co › blog-detail › how-to-check-java-path-in-linux
How to Check JAVA Path in Linux
Checking the Java path in Linux can be useful to ensure that the correct version of Java is being used by applications or development environments. To check the Java path in Linux, you can use the “which” command followed by “java” (e.g., ...