How To Install Java on Fedora 38
In this tutorial, we will show you how to install Java on Fedora 38. Are you a developer who needs to work with Java on your Fedora 38 system? Look no further! Java is an incredibly versatile and popular programming language, known for its cross-platform compatibility and extensive libraries. With so many benefits, it’s no wonder that Java is one of the most widely-used programming languages around.
But what if you’re not sure how to install Java on your Fedora 38 system? Don’t worry, we’ve got you covered. In this article, we’ll walk you through the process of installing Java on Fedora 38, so you can start using this powerful programming language right away. Let’s get started!
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Java programming language on a Fedora 38.
Prerequisites
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Java.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Java on Fedora 38
Step 1. Before we can install Java on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Java for any issues:
sudo dnf upgrade --refresh sudo dnf install dnf-plugins-core
Step 2. Installing Java on Fedora 38.
- Method 1. Install OpenJDK √
Run the following command to install OpenJDK:
sudo dnf install java-latest-openjdk
This command will download and install the latest version of the OpenJDK Java Development Kit, which is a free and open-source implementation of the Java platform.
After the installation is complete, you can verify that Java has been successfully installed by running the following command:
java -version
- Method 2. Install Oracle JDK √
First, visit the official website of Java and select the desired version of Java to download:
wget https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz
Once you have downloaded the package, extract it to a directory of your choice using the following command:
tar -xzf jdk-20_linux-x64_bin.tar.gz
Move the extracted package to the /opt
directory using the following command:
sudo mv jdk-20.0.1 /opt/
To use Java on your system, you need to set some environment variables. To do this, open the .bashrc
file in your home directory using the following command:
nano ~/.bashrc
Add the following lines to the end of the file:
export JAVA_HOME=/opt/jdk-20.0.1 export PATH=$PATH:$JAVA_HOME/bin
Save the file and exit, then reload the environment variables, and run the following command:
source ~/.bashrc
To verify that Java is installed on your system, run the following command:
java -version
Congratulations! You have successfully installed Java. Thanks for using this tutorial for installing the Java programming language on your Fedora 38 system. For additional help or useful information, we recommend you check the official Java website.