Setting JAVA_HOME Environment Variable in Windows 7
Before start this Chapter, you must have JAVA on your system. Please visit JAVA Installation and let begin with following chapter.
To set environment variables to enable the compilation and execution of Java applications from the command line (command prompt) or byusing an IDE like Eclipse. By installing the Java SDK, system variables about the location of executables (compiler, java virtual machine) are not defined or initialized automatically.
Testing is done by opening command prompt (Start -> cmd) and trying to launch the compiler with the command, If there is no system variable to indicate where to look for the this executable, the system will give an error like below screen
The Below steps are the solution to this problem is given by setting the system variables: JAVA_HOME, PATH and CLASSPATH:
Step 1: Go to the Control Panel -> System; and Click on Advanced System Settings
Step 3: From the above box, select the Environment Variables. and then select New and enter JAVA_HOME and enter the correct variable Path as like below screens
Step 5: Create a new system variable named, CLASSPATH as like above box, and its value %JAVA_HOME%\jre\lib
Stpe 6: For PATH, if it already exists, select it and choose the Edit option; in the editor add the value;%JAVA_HOME%\bin (the new values are separated by a semicolon from the existing ones)
To check the system variables is done by opening a new command prompt window (Start -> cmd) and try with following commands.
C:\Users\Catalin>echo %CLASSPATH%
C:\Program Files\Java\jdk1.6.0_16\jre\lib
C:\Users\Catalin>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_16
C:\Users\Catalin>echo %PATH%
Step 7: To make your system know of these changes, Restart your computer and can play with as you needed.
No comments:
Post a Comment