The following steps describe how to install the JDK on your development machine. (We will use a Windows 7 machine in these examples; the procedure may be slightly different for other platforms.)
- Go to the Oracle Java Downloads page.
- Click on Download Java Platform (JDK).
- Accept the license agreement.
- Choose your platform and download the installer.
- Follow the installation wizard and wait for the installation to complete.
Click on Java Platform (JDK) |
When the installation completes, follow these steps to set the JAVA_HOME environment variable:
- On the Desktop, right-click on Computer, then select Properties.
- Click on Advanced System Settings.
- If JAVA_HOME is not listed under User variables, click New.
- In the Variable Name field, type JAVA_HOME.
- In the Variable Value field, type the installation directory of the JDK; for example: C:\Program Files\Java\jdk1.7.0_25.
- Then click OK.
The Environment Variables window |
Setting the JAVA_HOME environment variable |
Now follow these steps to add the JDK bin/ directory to your PATH environment variable:
- In the Environment Variables window, select Path under System Variables and click Edit.
- In the Edit System Variable window, add the bin/ directory of the JDK installation to the Path variable; for example: C:\Program Files\Java\jdk1.7.0_25\bin
- Click OK on the Edit System Variable window.
- Click OK on the Environment Variables window.
- Click OK on the System Properties window.
Setting the Path environment variable |
To test that you have set the environment variables correctly, open a new terminal or command prompt window and type the following commands:
>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_25
>javac -version
javac 1.7.0_25
Your output shoud be similar to the output shown above.