skip to Main Content

I wonder if it is possible to find all JDK’s installed on my OS.

Let’s assume it’s one of the Debian-based distributions. I want to find any JDK in use, downloaded, or installed without being active. I want every JDK that could be used.

I need to include cases where somebody has changed the name the of package. I think the only solution is to search through the whole file system for specific jdk parts.

I know I can find all running java processes with jps -m or ps aux | grep java.

If I want to locate installed JDK’s, I can use update-alternatives --config java.

But is it also possible to find JDK that were only downloaded, but not installed?

In my opinion, the most specific corner case will be when somebody unpacked a JDK and then packed it to any format (like .tar,.zip etc) without making any changes.

2

Answers


  1. A quick and dirty way to find all JDK folders, wherever they might be, would be to just search for the file javac, which would be present in the bin/ folder of any JDK. On Linux, you may try from root:

    sudo find . -name 'javac'
    

    This approach should only find JDK, and not JRE, the latter which doesn’t have compile capabilities. You would follow a similar process on other OS, such as Windows.

    Login or Signup to reply.
  2. Try the following on the command-line:

    which java
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search