Installation Guide - JAVA-3438 (1) - 3438
Installation Guide - JAVA-3438 (1) - 3438
1. Open a command prompt by typing cmd in the search bar and press Enter.
If Java isn't installed, the output is a message stating that Java isn't recognised as an
internal or external command.
1
Install Java on Windows 10/11
After downloading the installation file, proceed with installing Java on your Windows
system.Follow the steps below:
2. Choose the destination folder for the Java installation files or stick to the
default path. Click Next to proceed.
2
3. Wait for the wizard to finish the installation process until the Successfully
Installed message appears. Click Close to exit the wizard.
3
Set Java environment variables to enable program compiling from any directory. To
do so, follow the steps below:
3. In the System Properties window, under the Advanced tab, click Environment
Variables…
4
4. Under the System variables category, select the Path variable and click Edit:
5
5. Click the New button and enter the path to the Java bin directory:
6
Note: The default path is usually C:\Program Files\Java\jdk-17.0.1\bin.
6. Click OK to save the changes and exit the variable editing window.
1. In the Environment Variables window, under the System variables category, click
the New… button to create a new variable.
7
2. Name the variable as JAVA_HOME.
3. In the variable value field, paste the path to your Java jdk directory and click OK.
8
Run the java -version command in the command prompt to make sure Java installed
correctly:
If installed correctly, the command outputs the Java version. Make sure everything
works by writing a simple program and compiling it. Follow the steps below:
class HelloWorld{
public static void main(String args[]){
System.out.println("Hello world!");
}
}
9
Note: When using Notepad, select All files for the Save as type option and add the
.java extension to the file name.
javac [filename]
For example:
After a successful compilation, the program generates a .class file in the file
directory.
java [filename]
The output shows that the program runs correctly, displaying the Hello world!
Message.
10
Installing the JDK on macOS
System Requirements
The following are the system requirements for installing the JDK on macOS:
● Any Intel-based computer running macOS.
● Administrator privileges are required to install the JDK on macOS. We cannot
install Java for a single user. Installing the JDK on macOS is performed on a
systemwide basis for all users.
$ java -version
java version "15"
Java(TM) SE Runtime Environment (build 15)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b04, mixed mode)
To run a different version of Java, either specify the full path, or use the java_home tool. For
example:
11
2. From either the browser Downloads window or from the file browser,
double-click the .dmg file to start it.
A Finder window appears that contains an icon of an open box and the name
of the .pkg file.
3. Double-click the JDK 15.pkg icon to start the installation application.
The installation application displays the Introduction window.
4. Click Continue.
The Installation Type window appears.
5. Click Install.
A window appears that displays the message: Installer is trying to install new
software. Enter your password to allow this.
6. Enter the Administrator user name and password and click Install Software.
The software is installed and a confirmation window is displayed.
Note: After the software is installed, you can delete the .dmg file if you want to save disk
space.
12
For example, to uninstall 15 Interim .
$ rm -rf jdk-15.jdk
13
Installing JDK on Linux Platform
This topic describes general information about installing JDK 18 on Linux platforms.
jdk–18.interim.update.patch.
Note:If you install JDK in a specific location such as /usr/jdk, then you must log in
with root credentials to gain the necessary permissions. If you do not have the root
access, then either install the JDK in your home directory or a subdirectory for which
you have the write permissions.
Overwriting Files
If you install the software in a directory that contains a subdirectory named jdk–
18.interim.update.patch, then the new software overwrites files of the same name in that
directory. Ensure that you rename the old directory if it contains files that you would like to
keep.
System Preferences
By default, the installation script configures the system such that the backing store for system
preferences is created inside the JDK installation directory as applicable. If the JDK is
installed on a network-mounted drive, then the system preferences can be exported for
sharing with Java runtime environments on other machines.
14
jdk-18_linux-x64_bin.tar.gz
jdk-18_linux-aarch64_bin.tar.gz
Installing the JDK on Linux from Archive Files and RPM Packages
- You can install the Java Development Kit (JDK) on a Linux platform from archive files or
from Red Hat Package Manager (RPM) packages.
● From RPM packages (.rpm): This allows you to perform a systemwide installation of
the JDK for all users, and requires root access. See the following table for the options
available for downloading and installing the JDK from Linux x64 and Linux aarch64
(64-bit ARM) RPM packages.
- Access Java SE Downloads page and click Accept License Agreement. Under the
Download menu, click the Download link corresponding to your requirement.
- The following table lists the options and instructions for downloading and installing the
JDK 18 release on a Linux platform:
Architecture
Download File Instructions (CPU Type) Who Can Install
15
For Linux x64 Installing the Intel - 64-bit Anyone
systems: 64-Bit JDK on
jdk-18.interi Linux Platforms
m.update.patc
h_linux-x64.t
ar.gz
The .tar.gz archive file (also called a tarball) is a file that can be uncompressed and
extracted in a single step.
16
● For Linux aarch64 (64-bit ARM) systems:
jdk-18.interim.update.patch_linux-aarch64_bin.tar.gz
2. Before you download a file, you must accept the license agreement. Anyone (not
only root users) can install the archive file in any location having write access.
3. Change the directory to the location where you want to install the JDK, then move the
.tar.gz archive file to the current directory.
4. Unpack the tarball and install the downloaded JDK:
$ tar zxvf jdk-18.interim.update.patch_linux-x64_bin.tar.gz
OR
$ tar zxvf jdk-18.interim.update.patch_linux-aarch64_bin.tar.gz
The Java Development Kit files are installed in a directory called
jdk-18.interim.update.patch.
5. Delete the .tar.gz file if you want to save disk space.
Ensure that you have the root user access. You can do this by running the command su and
entering the superuser password.
Note:JDK 18 can coexist with earlier versions of JDK. For each version, a new directory is
created, the default directory being /usr/java/jdk-18.interim.update.patch.
17
The JDK installation is integrated with the alternatives framework. After installation, the
alternatives framework is updated to reflect the binaries from the recently installed JDK. Java
commands such as java, javac, javadoc, and javap can be called from the command line.
Using the java -version command, users can confirm the default (recently installed) JDK
version.
In addition, users can check which specific RPM package provides the java files:
18
19