0% found this document useful (0 votes)
0 views10 pages

Installing Java 17

This document provides a step-by-step guide for installing Java 17 on both Mac and Windows operating systems. It includes instructions for downloading the appropriate installer, completing the installation process, and verifying the installation through command line commands. Users are also guided on how to set the PATH variable and run Java programs after installation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views10 pages

Installing Java 17

This document provides a step-by-step guide for installing Java 17 on both Mac and Windows operating systems. It includes instructions for downloading the appropriate installer, completing the installation process, and verifying the installation through command line commands. Users are also guided on how to set the PATH variable and run Java programs after installation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Installing Java 17

Downloading

To install the latest version of Java, go to the download site at Oracle.com.

Scroll down to Java SE Development Kit 17.0.2 downloads. Click on the appropriate platform
(Linux, Mac, or Windows).

For mac, use the x76 DMG installer. Click the link to download the file.

For windows, use the x86 MSI Installer. Click the link to download the file.
Installing on Mac OS

Double click on the DMG file (It is probably in Downloads but you can move it elsewhere
before installing if you wish.)

This will open the dmg and show a pkg file. Double click that Icon to start the install.

Click Continue.
Click Install

The install procedure will ask for a password (or for a ‘touch’ if you have a biometric
enabled macbook).

Touch the biometric sensor or click ‘Use Password’ and enter your user account password
on the macbook.
It will proceed with install and finally show the following:

Click the ‘Close’ button.

Using Java 17 on Mac (Command Line)

The install script will place the JDK in the directory tree at /Library/java.
You will need to add the correct directory with java binaries to the front of your path
variable in the terminal. Note that in these examples, I use the free product XQuartz for my
terminal and Unix environment. However, you can do the same thing with the native Mac
Terminal.
To open a terminal window, go to launchpad, type ‘Terminal’ in the search bar and click the
Terminal Icon.
To look at the value of your PATH variable (this is where the OS searches for programs to
run), type:

set | grep PATH

You will modify this by placing the binary directory for the java jdk ahead of the other
directories in the path. Use:

export PATH=/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home/bin:$PATH

Note that adding the ‘:$PATH’ at the end is cricital or your terminal will not be useable!

Now you should be able to use Java. Connect to a directory where you have your Java
source files.

Verify that you are using the correct version by typing ‘java –version’. It should show 17.0.2.
Then you can build java programs with the javac command and executing them by running
the Java runtime environment using the java command.
Installing on Windows 10

After you download the msi file from the Java download site, it should be in your Downloads
folder. You can move it elsewhere if you wish or leave it there. Double click on that file to
run it and install Java.

You will be walked through a series of dialog boxes. Accept all the defaults by clicking the
Next button each time.
At this point, windows may display a dialog asking if you wish to modify system software.
Click the Yes button to allow the install to continue.
u

Click the Close button to dismiss the final dialog. Java is now installed and should be
available at your command prompt.

Run the command prompt (terminal) window by searching for CMD and selecting
‘Command Prompt’.
Using Java 17 on Windows 10

Verify Java is correctly installed by having it print its version number.

Type: java –version

If it shows version 17.0.2 is installed ,you are ready to build and run programs. Change your
default folder to one containing your Java source code.

To build a program, type javac and the program name (see below). To execute the generate
class file, just type java followed by the class name (no .class extension).

You might also like