If you prefer, you can download and install the open-source version of Java.
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.
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 pathProgram 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 thePath
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:
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.
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.
The name of the bin
folder may vary on your system, as in this example:
c:\Program Files\Java\jdk-14.0.1\bin;<em>other directories...</em>
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.