Menu
Download and Install the Java Development Kit By Doug Lowe

Before you can start writing Java programs, you have to download and install the correct version of the Java Development Kit (JDK) for the computer system you're using. Oracle's Java website provides versions for Windows, Solaris, and Unix. The following sections show you how to download and install the JDK.

Download the JDK

To get to the download page, point your browser to this Oracle page. Then follow the appropriate links to download the latest version of Java SE for your operating system. (At the time I wrote this, the latest version was 14.01.)

When you get to the Java download page, you find a link to download the Java JDK. Click this link, and then select your operating system and click the JDK Download link to start the download.

The JDK download comes in two versions: an executable installer and a .zip file. Both are about the same size. I find it easier to download and run the .exe installer.

Install the JDK

After you download the JDK file, you can install it by running the executable file you downloaded. 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.

The JDK folders

When the JDK installs itself, it creates several folders on your hard drive. The locations of these folders vary depending on your system, but in all 32-bit versions of Windows, the JDK root folder is in the path Program Files\Java on your boot drive. On 64-bit versions of Windows, the root folder will be either Program Files\Java or Program Files (x86)\Java. The name of the JDK root folder also varies, depending on the Java version you've installed. For version 14.0.1, the root folder is named jdk-14.0.1.

The table lists the subfolders created in the JDK root folder. As you work with Java, you'll refer to these folders frequently.

Subfolders of the JDK Root Folder

Folder Description
bin The compiler and other Java development tools
conf Configuration files
include This library contains files needed to integrate Java with programs written in other languages
jmods Modules for the Java Module System (new with Java 1.9)
legal Copyright and license information for various Java components
lib Library files, including the Java API class library

Setting the path

After you install the JDK, you need to configure your operating system so that it can find the JDK command-line tools. To do that, you must set the Path environment variable - a list of folders that the operating system uses to locate executable programs. Follow these steps:

1. Open Windows Explorer, right-click This PC, and choose Properties.

This brings up the System Properties page.

2. Click the Advanced System Settings link.

3. Click the Environment Variables button.

The Environment Variables dialog box appears, as shown.

Environment Variables dialog box

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

This brings up a handy dialog box that lets you add or remove paths to the Path variable or change the order of the paths, shown.

Editing Path variable

5. Add the bin folder to the beginning of the Path value.

6. Click New, key in the complete path to the bin folder, and press Enter.

7. Use the Move Up button to move the bin folder all the way to the top of the list.

8. 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.

For Linux or Solaris, the procedure depends on which shell you're using. For more information, consult the documentation for the shell you're using.

About the Book Author

Doug Lowe began writing computer books before Java was invented. He's covered dinosaurs such as COBOL, FORTRAN, and IBM mainframe computers, as well as web programming, Microsoft PowerPoint, and networking. Doug has written more than 30 For Dummies computer guides.

Java is a vital skill for any programmer. This convenient one-stop guide brings together the essentials to take you from wide-eyed Java novice to skilled user with a minimum of frustration. You'll learn the basics of writing Java code and then apply those skills to real projects. Along the way learn the details of object-oriented programming, JavaFX, and programming for the web. You can dive even deeper and grab a free bonus section on files and databases at dummies.com. Before you know it, you'll be building your own web apps and databases.

7 Books Inside ...

Java Basics
Programming Basics
Object-Oriented Programming
Strings, Arrays, and Collections
Programming Techniques
JavaFX
Web Programming
Web bonus: Files and Databases