Installing JDK and setting JAVA_HOME
Question
- What exactly is the purpose of JDK - running java programs or developing?
- 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?
- Who uses JAVA_HOME and what should I set it to be?
Solution
- JDK is development environment. JVM is runtime environment.
- You should download java installer from oracle web site or install it from repositiry manager
JAVA_HOME
system variable usually is required for enterprice java software (application servers, DBs, development tools and so on). You should setJAVA_HOME
variable to root directory of JDK or JVM(setting it to JDK always works, but maybe some software will run as expected withJAVA_HOME
pointing to JRE). If you setJAVA_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
- JDK - Java Development Kit (in contrast to JRE - Java Runtime Environment).
- 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.
- 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