Oracle just recently released the Java JDK 17 last year with new features and improve performance. Here’s how to install the latest JDK in your system through archives and repositories.
Oracle just made its latest LTS release available for all users worldwide. Just like its predecessors, you can install Oracle Java JDK 17 on Linux in two ways: via the archives or via your package manager. The best option depends on your comfort level and situation. But today, we’ll take a look at both methods and provide beginner-friendly instructions.
Oracle JDK or the Java Development Kit is a Java version that consists of developer tools such as compilers, debuggers, and more. If you are working on a Java project or want to learn more about this language, you need JDK installed on your PC. You can install JDK through a simple executable file on Windows.
Unfortunately, this is not the case for Linux operating systems. You will need to choose what kind of installation is the best for you. For those who want to customize their installations, the archive version is the best option. The “.deb” or “.rpm” installs via default, so everyone within a system uses one version universally.
The archived version is also preferred if you want to debug issues on older systems. However, the best thing about the archived version is that you can update other Java PCs without the internet. You can automate this process by deploying an automated script.
You can check the system configuration table to verify if your system can run the latest Oracle JDK version. But the gist of the table is that if you have the latest browser and distro version with 64-bit architecture, you’ll be able to install the Oracle JDK 17.
If you’re using a distro that has been discontinued, or if you’re running an older version that is no longer supported by the OS provider, you might not get a certified installation. You can also manually install and register the Java Plug-in by using the official installation guide from Oracle.
Just like any other files or software installation, you will need root access if you would like to put something in the
/usr/jdk. By default, if root access is not available, the archive will be installed in the home directory or any directory that you have
Check if an installation of JDK 17 is available, configured, and is being used by someone else for a project. Once you install the latest version, the directory or files with the same names will be overwritten. You can backup your old install folder by renaming it and making a new
The tarballs are for installing the JDK 17 version in archive mode. You can also get the packages for the Debian and RHEL versions below. All of these files are from the official Oracle download.
One of the best and most commonly used ways to install Oracle Java JDK 17 is via the downloadable archives. This is due to the flexibility of the profiling if the user wants to use different JDK versions for their projects.
Once you have downloaded the archive for the JDK 17 version, use the code below to unpack and install the tarball. Go to the
/usr/local and make a java directory (if it doesn’t exist yet). Get to your java folder and execute this command. The
pathname is where your downloaded tarball would be, in my case, it was on the Download folder.
$ sudo tar xvzf ~/pathname/jdk-17_linux-x64_bin.tar.gz
Execute the code below once you have extracted the tarball’s content in
/usr/bin/java. This informs the system that you’ll be using the version located in the java directory.
$ sudo update-alternatives --install “/usr/bin/java” “java” “/usr/local/java/jdk-17.0.2/bin/java” 1
Once executed, the previous code should not have any reports in the output. You can then use the code below to check your Java version and verify that your installation was successfully executed.
$ java -version
Installing Oracle Java JDK 17 for Debian-based Distros
For Debian-based distros, you can install the “.deb” package just like any other packages using the
dpkg. Go to the directory where the .deb file was saved using your Terminal. You can use this code:
$ sudp apt install ./jdk-17_linux-x64_bin.deb
Or you can isolate the .deb into a folder and execute the code below. Alternatively, you can double-click on the file and let your package manager do the job.
$ dpkg -i *.deb
You can also install the OpenJDK version by using the code below if you’re having some problems with the official installation package:
$ sudo apt install default-jdk
Oracle also provides installation packages for RHEL-based distros. Like the Debian version, you can download the “.rpm” file with the links above. Navigate your Terminal until you are in the same directory as the file, then execute this code. It can take a few minutes, but the installation is seamless.
$ sudo rpm -ivh jdk-17_linux-x64_bin.rpm
To check your install integrity, you can check your java version again. Or, if you have a few simple source codes, you can also test it and see if your configs still work with the newest Oracle JDK version. Here’s how to run Java from the command line in the Linux terminal for beginners.
And that’s it for this installation guide, and I hope you learn something new and helpful today. You can check out some of the installation guides available on this site, such as how to install PostgreSQL, Drupal 9, or even PowerShell if you want to explore one of Window’s most iconic utilities within your Linux distro.
If this guide helped you, please share it. ?