How to Add Buttons and Text to Your JavaFX Project
Tips for Beginning Java Programmers: How to Decide on a Loop’s Limit at Runtime
Parsing XML Events with SAX

Download and Install the Java Development Kit

The Java Development Kit (JDK) download comes in two versions: an online version that requires an active Internet connection to install the JDK, and an offline version that lets you download the JDK installation file to your computer and install it later.

Download the Java Development Kit

The Java Development Kit (JDK) can be downloaded from Oracle. The Java download tab includes links to download the JDK or the Java Runtime Environment (JRE). Follow the JDK link because clicking the JRE link gets you only the JRE, not the complete JDK.

Use the offline version. That way, you can reinstall the JDK if you need to without having to download it again.

The exact size of the offline version depends on the platform, but most versions are between 50MB and 60MB, so that means that your download will take a few hours if you don’t have a high-speed Internet connection. With a broadband cable, DSL, or T1 connection, though, the download takes less than five minutes.

After you download the JDK file, install it by running its executable file. The procedure varies slightly depending on your operating system, but basically, you just run the JDK installation program file after you download it, as follows:

  • On a Windows system, open the folder in which you saved the installation program and double-click the installation program’s icon.

  • On a Linux or Solaris system, use console commands to change to the directory to which you downloaded the file and then run the program.

After you start the installation program, it prompts you for any information that it needs to install the JDK properly, such as which features you want to install and what folder you want to install the JDK in. You can safely choose the default answer for each option.

Note: If you’re an Apple Mac user, you don’t have to download and install the Java JDK. Apple pre-installs the JDK on Mac computers.

JDK folder structure

The JDK setup program creates several folders on your hard drive. The locations of these folders vary depending on your system, but in all versions of Windows, the JDK root folder is in the path Program Files\Java on your boot drive. The name of the JDK root folder also varies, depending on the Java version you’ve installed. For version 1.7, the root folder is jdk1.7.0.

Here are the subfolders created in the JDK root folder. As you work with Java, you’ll refer to these folders frequently.

Folder Description
bin The compiler and other Java development tools
demo Demo programs you can study to see how to use various Java features
docs The Java application programming interface (API) documentation
include The library containing files needed to integrate Java with programs written in other languages
jre JRE files
lib Library files, including the Java API class library
Sample Sample code

In addition to these folders, the JDK installs several files in the JDK root folder.

File Description
README.html The Java README file in HTML format.
README.txt The README file, this time in text format.
LICENSE The Java license you agree to when you download the JDK.
LICENSE.rtf The license file, this time in RTF format.
COPYRIGHT The copyright notice.
Src.zip The source code for the Java API classes. This folder is created only if you unpack the src.zip file (which may be named src.jar). After you get your feet wet with Java, looking at these source files can be a great way to find out more about how the API classes work.

RTF (rich text format) is a document format that most word-processing programs can understand.

Set the path for Java

After you install the JDK, you need to configure your OS so that it can find the JDK command line tools. Start by setting the Path environment variable — a list of folders that the OS uses to locate executable programs. To do this on a Windows XP, Windows Vista, or Windows 7 system, follow these steps:

  1. Click the Windows (Start) button and then right-click Computer (Windows 7 or Vista) or My Computer (XP).

    This brings up the System Properties page.

  2. Click the Advanced tab (XP) or the Advanced System Settings link (Vista and 7); then click the Environment Variables button.

    The Environment Variables dialog box appears.

  3. In the System Variables list, scroll to the Path variable, select it, and then click the Edit button.

    A dialog box pops up to let you edit the value of the Path variable.

  4. Add the JDK bin folder to the beginning of the Path value.

    Use a semicolon to separate the bin folder from the rest of the information that may already be in the path.

    The name of the bin folder may vary on your system, as in this example:

    c:\Program Files\Java\jdk1.7.0\bin;other directories...
  5. Click OK three times to exit.

    The first OK gets you back to the Environment Variables dialog box; the second OK gets you back to the System Properties dialog box; and the third OK closes the System Properties dialog box.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Java Programming Challenge: Adding a GUI to the Tic-Tac-Toe Program
Numbers without Decimal Points in Java
How to Create a JTree Component in Java
Default Scope in Java
How to Synchronize Methods When Using Java Threads
Advertisement

Inside Dummies.com