Reputation: 197
I want to start a project in eclipse, but when I try to start eclipse, it doesn't open. My instructor said I'd have to set the environment variables. What is the importance of environment variables like PATH
, CLASSPATH
, JAVAHOME
and what are their correct values?
Upvotes: 5
Views: 43802
Reputation: 319
Eclipse IDE itself uses Java to start and run. On windows you should have something called environment variables like PATH and JAVA_HOME, where locations of programs can be stored. In case of Java it can be very convenient, because when you have different versions, all you have to do is to edit your PATH or your JAVA_HOME. If you don't set those variables then, programs like Eclipse might not know what to use.
Classpath is slightly different because that's what your java program uses, you'll learn more about it when you will get some experience in java programming.
Upvotes: 0
Reputation: 10646
As I understand your question, you are having problems with starting Eclipse? If so, you have most likely not a correct path to the JRE/JDK. See this FAQ for help.
In short, you typically want to set your PATH variable to point to the java executable. Note that Eclipse does not use JAVA_HOME
at all.
Upvotes: 0
Reputation: 22710
So that Eclipse will know where Java is.
JAVA_HOME is not used by Java itself. Some third-party programs (for example Apache Tomcat) expect one of these environment variables to be set to the installation directory of the JDK or JRE. If you are not using software that requires them, you do not need to set JAVA_HOME and JRE_HOME.
CLASSPATH is an environment variable which contains a list of directories and / or JAR files, which Java will look through when it searches for Java classes to load. You do not normally need to set the CLASSPATH environment variable. Instead of using this environment variable, you can use the -cp or -classpath option on the command line when using the javac and java commands.
PATH is an environment variable used by the operating system (Windows, Mac OS X, Linux) where it will look for native executable programs to run. You should add the bin subdirectory of your JDK installation directory to the PATH, so that you can use the javac and java commands and other JDK tools in a command prompt window. The JDK installation instructions explain how to set PATH.
Upvotes: 7