Which of these is my JDK path, and which is JAVA_HOME?

IAmYourFaja picture IAmYourFaja · Aug 28, 2012 · Viewed 12k times · Source

I just installed Linux Mint and am trying to configure SpringSource Tool Suite which requires you to direct it to the system "JDK path". Although I haven't explicitly downloaded/installed Java on this system yet, when I ran the update manager I did see Open JDK get installed and found several directories under /usr/lib/jvm (see screenshot below). My questions are:

  • Spring Tool Suite requires you to specify a path to the JDK, and my question is, which one do I choose, and why?; and
  • How do I tell which of these is my JAVA_HOME?; and
  • What's the difference between the "JDK path" and JAVA_HOME?

enter image description here

Thanks in advance!

Edit:

echo $PATH --> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

java -version -> java version "1.7.0_03" OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3) OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)

which java -> /usr/bin/java

Answer

Kevin Sitze picture Kevin Sitze · Aug 28, 2012

Spring Tool Suite requires you to specify a path to the JDK, and my question is, which one do I choose, and why?; and

This can only be answered according to the needs of your application. Do you need the stability of Java 6 or the features added in Java 7? Are there APIs you intend to use that are only available in Java 7 or are the Java 6 libraries sufficient? Do you have customers that require the use of one JVM over another? Only you can answer these questions.

How do I tell which of these is my JAVA_HOME?; and

You will want to make JAVA_HOME reference the specific JVM environment that you've decided on for your project. For example, if you decide on Java 6 you'll probably want to set your JAVA_HOME to /usr/lib/jvm/java-6-openjdk-amd64.

What's the difference between the "JDK path" and JAVA_HOME?

The JDK path refers to the Java Development Kit - which includes the java compiler, debugger and other tools associated with developing java programs. JAVA_HOME can reference either the JDK root or the JRE (Java Runtime Environment) root directory when running java programs; but you should, for development purposes, always have JAVA_HOME reference the JDK root.