Monday, July 29, 2013

Installing the Java Software Development Kit (JDK)

The first software package that you need to install for creating Java EE applications is the JDK, which enables you to compile Java source files into binary class files. In addition to the Java compiler, the JDK includes the Java Runtime Environment (JRE), which provides a Java virtual machine that application servers can run on.

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.)
  1. Go to the Oracle Java Downloads page.
  2. Click on Download Java Platform (JDK).
  3. Accept the license agreement.
  4. Choose your platform and download the installer.
  5. 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:
  1. On the Desktop, right-click on Computer, then select Properties.
  2. Click on Advanced System Settings.
  3. If JAVA_HOME is not listed under User variables, click New
  4. In the Variable Name field, type JAVA_HOME. 
  5. In the Variable Value field, type the installation directory of the JDK; for example: C:\Program Files\Java\jdk1.7.0_25
  6. 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:

  1. In the Environment Variables window, select Path under System Variables and click Edit.
  2. 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
  3. Click OK on the Edit System Variable window.
  4. Click OK on the Environment Variables window.
  5. 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.

No comments:

Post a Comment