Question

  1. What exactly is the purpose of JDK - running java programs or developing?
  2. There seems to be too many packages that include java and jdk/sdk in their title. Which one should I install if I want to develop Java applications?
  3. Who uses JAVA_HOME and what should I set it to be?
Was it helpful?

Solution

  1. JDK is development environment. JVM is runtime environment.
  2. You should download java installer from oracle web site or install it from repositiry manager
  3. JAVA_HOME system variable usually is required for enterprice java software (application servers, DBs, development tools and so on). You should set JAVA_HOME variable to root directory of JDK or JVM(setting it to JDK always works, but maybe some software will run as expected with JAVA_HOME pointing to JRE). If you set JAVA_HOME right then $JAVA_HOME/bin/java -version command should pring version of java.

OTHER TIPS

JRE means Java Runtime Environment. Most Java Software only needs a JRE to run.

JDK means Java Development Kit. A JDK allways includes a JRE. If you develop you most certainly allways use the JDK, since it contains source and docs of java's own Classes.

Also there is software (usually software for development) that uses tools of the JDK to run, e.g. this software needs the JDK as runtime environment (for example: ant).

JVM means Java Virtual Machine and is the program that runs your java program no matter if in JRE or JDK.

JAVA_HOME is the path to the JDK

JRE_HOME is the path to the JRE

  1. JDK - Java Development Kit (in contrast to JRE - Java Runtime Environment).
  2. If you don't know which version of Java you need, just get the latest (currently Java Platform (JDK) 7u5). Unless you already have a development tool, you might want the Netbeans bundle instead.
  3. JAVA_HOME is used by some software that depends on Java - ant, which is a build tool, is one that comes to mind. It should be set to the directory which contains the bin directory, which in turn contains the java executables.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top