Do I need all three environment variables if I want to compile/run or just run Java applications in linux platform?
JAVA_HOME export JAVA_HOME=/opt/jdk1.7.0_75
JRE_HOME export JRE_HOME=/opt/jdk1.7.0_75/jre
PATH export PATH=$PATH:/opt/jdk1.7.0_75/bin:/opt/jdk1.7.0_75/jre/bin
No, you don't usually need JRE_HOME
(may need to add it if other applications are looking for it, but I have never needed it). You do need JAVA_HOME
because many applications (like Tomcat) look for this. Also, in your PATH, use $JAVA_HOME/bin
; instead so that if you upgrade your Java, you don't have to change PATH as well :-)