How to install java

Step 1) Go to link. Click on JDK Download for Java download JDK 8.

How to install java

  1. Accept License Agreement
  2. Download Java 8 JDK for your version 32 bit or JDK download 64 bit.

How to install java

Step 3) When you click on the Installation link the popup will be open. Click on I reviewed and accept the Oracle Technology Network License Agreement for Oracle Java SE development kit and you will be redirected to the login page. If you don’t have an oracle account you can easily sign up by adding basics details of yours.

How to install java

NOTE: You will be required to create an Oracle Account to start Java 8 download of the file.

Step 4) Once the Java JDK 8 download is complete, run the exe for install JDK. Click Next

How to install java

How to install java

NOTE: Follow the onscreen instructions in succeeding steps to install Java 8 on Windows 10.

Step 6) Once you install Java in windows, click Close

How to install java

How to set Environment Variables in Java: Path and Classpath

The PATH variable gives the location of executables like javac, java etc. It is possible to run a program without specifying the PATH but you will need to give full path of executable like C:\Program Files\Java\jdk1.8.0_271\bin\javac A.java instead of simple javac A.java

The CLASSPATH variable gives location of the Library Files.

Let’s look into the steps to set the PATH and CLASSPATH

Step 1) Right Click on the My Computer and Select the properties

How to install java

Step 2) Click on advanced system settings

How to install java

How to install java

Step 4) Click on new Button of User variables

How to install java

Step 5) Type PATH in the Variable name.

How to install java

Step 6) Copy the path of bin folder which is installed in JDK folder.

How to install java

Step 7) Paste Path of bin folder in Variable value. Click on OK Button.

How to install java

Note: In case you already have a PATH variable created in your PC, edit the PATH variable to

Here, %PATH% appends the existing path variable to our new value

Step 8) You can follow a similar process to set CLASSPATH.

How to install java

Note: In case you java installation does not work after installation, change classpath to

Step 9) Click on OK button

How to install java

Step 10) Go to command prompt and type javac commands.

If you see a screen like below, Java is installed.

How to install java

Having trouble installing Java? Check our Online Java Compiler

How to install java Azhwani • May 23, 2021 • java • 5 mins read

Table of Contents [ Show ]

In this short tutorial, we’re going to take a close look at how to install Java on Windows 10.

We’ll first start with a little insight into how to download Java. Then, we’ll explain how to install it on Windows 10. Then, we’re going to see how to properly set JAVA_HOME environment variable.

Lastly, we’ll highlight different ways to check Java and JDK versions on Windows 10.

So, let’s get started

Download Java for Windows 10

In this section, we’re going to cover in-depth all the steps required to download Java for Windows 10.

As a matter of fact, downloading Java is a piece of cake. It’s just a matter of a few clicks and simple one-time steps.

First, we need to visit the official Oracle download page and choose the right release for the Java SE Platform.

At this point in time, the latest version is Java SE 16.0.1.

Secondarily, we need to click on the JDK Download button:

How to install java

Bear in mind that Oracle has dropped the support for 32 bit systems. As a result, we can use Java SE only in 64 bit machines.

For instance, Oracle offers two options to install Java on Windows: through a .zip file and a .exe executable file.

Next up, let’s choose the Windows x64 Installer option:

How to install java

Then, we have to accept the Oracle Technology Network License Agreement for Oracle Java SE to proceed to the next step:

How to install java

Lastly, a simple click on the download button will do the job.

Install Java on Windows 10

Now that we download Java for Windows 10, let’s see how to install it. Basically, the process of installing Java on Windows 10 is pretty easy and simple.

In general, we don’t need to change anything during the installation, we can go with the default settings and follow the suggested instructions.

Firstly, we need to double click on the downloaded installer file to start the installation process:

How to install java

Secondarily, we click Next to continue:

How to install java

Note that, “C:\Program Files\Java\” is the default Java installation folder! However, we can always change it if we want that.

Then, we keep hitting Next until the installation is complete:

How to install java

Finally, we close the installer window once the installation of JDK is complete on our Windows 10.

Set Java Path in Windows 10

Now that we known how to install Java on Windows 10, it’s time to proceed to the next step.

In this short chapter, we’re going to dive deep into how to set JAVA_HOME environment variable on Windows 10. Please note that, JAVA_HOME should point to a JDK folder not JRE.

The basic idea behind setting the Java Path is to make all the Java commands like java, javac… accessible from everywhere. That way, we can run Java programs from anywhere.

First, let’s open the Advanced System Settings. To do that, we just need to press Windows key + Pause Key. Alternatively, we can type View advanced system settings in the search box.

Once the System Properties window is opened, we click on Environment Variables:

How to install java

Secondarily, we click on New button to create a new System variable with JAVA_HOME as name and the path to the JDK directory as value:

How to install java

As we can see, the JAVA_HOME environment variable points to the JDK folder which C:\Program Files\Java\jdk-16.0.1 is in our case.

How to install java

Next, we need to update the Path variable by adding a new entry for %JAVA_HOME\bin%:

How to install java

Finally, we can click OK to save and apply the changes.

That’s all we can say about downloading and installing java on windows 10. Now, we’re ready to write our first Java program.

Check Java Version on Windows 10

There are multiple ways that we can use to check Java version on Windows 10. Basically, when we say Java version, we mean JRE version.

The most obvious and basic way is to use the terminal. Firstly, press Win+R and type cmd to open the Command Prompt. After that, type java -version and press Enter:

The output means that Java is properly installed on our operating system.

Alternatively, we can type “Java” in the search box and click on “About Java”:

How to install java

Please bear in mind that multiple versions of JDK can be installed on the same on Windows 10 machine. So, it’s important to make sure the JAVA_HOME environment variable points to the right JDK release.

Let’s open a new command prompt and type:

As show above, the environment variable JAVA_HOME points to the directory of the lastest JDK version.

We can also use javac -version to verify the version of the installed JDK:

Another important thing to note is that the JDK version can be different from the JRE version on the same machine.

Please keep in mind that we need always to check for new Java updates and install them to keep our machines up-to-date with the latest releases.

In case you want to check how to enable Java on Chrome and other browsers, feel free to take a look at this article: https://devwithus.com/enable-java-chrome/

Conclusion

In this article, we’ve explained how to tackle the challenge of downloading and installing Java on Windows 10. Then, we’ve seen how to add JAVA_HOME and append %JAVA_HOME\bin% to the Path.

Lastly, we have showcased how to verify and check the installed Java version.

This guide will guide you through the process of downloading and installing Java on Windows.

PLEASE NOTE! Java (not to be confused with JavaScript!) is very old technology.

You do not require Java installed to use the modern internet. However some very old websites may still require it to use some kind of out-dated system, but generally speaking Java is dead and gone.

Additionally, Java is notorious for having security problems and bugs, so if you do install it, make sure you keep it up to date.

Only install Java if you are certain you require it!.

If a website has warned you that you don’t have JavaScript enabled and you’ve found this page to fix the problem; the chances are you’re actually looking for our guides to enable JavaScript instead.

Visit the Java website and download the installer

To install Java, you first need to download the installer program from Oracle.

Click the “Free Java Download” button.

How to install java

You are then prompted to read and agree with the end user license agreement.

How to install java

Depending on which web browser you are using to download Java and depending on its configuration, you may be prompted to either Download, Save or Run the installer file.

If you are prompted to run the Java installer file from Oracle, it is ok to just click the Run button. You also may prefer to save it to your disk and then manually find and run the installer yourself.

Run the installer

Depending on your Windows Security Settings, you may be prompted to allow the Java Installer to modify files on your computer. This is an important safeguard to make sure you really want to let software you’ve downloaded from the internet make changes to your computer. Please make sure this is the correct installer file and then when you’re satisfied that it is, click the “Yes” button.

How to install java

Install Java

You are now shown the Java installer program.

You can optionally change the Java install destination folder (using the checkbox in the bottom left), however this is an advanced option and should only be used by users who have a specific need to configure Java. It is fine to ignore this option.

When you have read and are ready to accept the license agreement, click the “Install” button.

How to install java

Java will now download and install itself.

How to install java

Congratulations, you have now installed Java.

How to install java

Verify Java

The Java installer will open your default web browser and prompt you to verify your Java installation.

Chrome doesn’t support Java any more

Google Chrome no longer supports Java on websites. Fewer sites use Java these days and the NPAPI system that Java uses has often caused security risks on websites. You can read more about it in the official statements from Google and Oracle:

If you try to use Chrome to verify your Java installation, you will get an error:

How to install java

You need to use a different browser (such as Safari or Firefox) which still supports Java.

Typically, you will be prompted to allow the Java plugin to run. The following screenshot is taken from Internet Explorer.

  1. First, verify that it is the offical Java plugin which is requesting permission to run. At the time of the production of this guide, the plugin name is Java(tm) Plug-In SSV Helper and it is published by Oracle America, Inc.
  2. When you are satisfied it is the correct plugin, click the Enable button.
  3. Then click the red Verify Java version button on the Java website.

How to install java

You are then prompted one more time by Java itself if you want to run this application. Pay attention to the warning it gives about granting unrestricted access to your computer. You should always be very careful when you run Java applications; make sure you only run applications from companies you trust.

In particular, always look at the Publisher name.

In this instance, we are talking about a Java application made by the company who creates Java (“Oracle America, Inc.”); so it’s probably pretty safe to run. When you are ready, click the “Run” button on the warning.

How to install java

After you allow this Java app to run, it will verify that you have Java installed and (provided that everything during the installation worked) show you a message to this effect.

How to install java

The default configuration for Java is to automatically check for updates and install them when they are available. This helps to keep Java patched and your computer safer.

By How to install javaPriya Pedamkar

How to install java

How to Install JDK?

The Java Development Kit (JDK) is helpful to write programs in Java. It is also known as the Java Platform Standard Edition (Java SE). JDK is an open-source software provided by Sun Microsystems, now taken over by Oracle, for anyone to use freely for programming.

Do many people have the question, JDK or JRE? So let us look at what each is used for. Java Runtime Environment (JRE) is required for running programs of Java, whereas JDK is required for writing and running the programs. JDK is a development kit containing JRE and the development tools (debugger and compiler) needed for getting a program output in Java. Simply put, JRE happens to be a subset of JDK; that is, it is included in JDK. Therefore, we will need to install JDK to write and run programs.

Web development, programming languages, Software testing & others

Installation Prerequisites of JDK

JDK has bare minimum requirements for disk space and RAM for the 64-bit Windows platform. It requires around 800 MB disk space to install JDK, as JRE also gets installed along with it. JDK requires 128 MB of memory space to run JDK successfully. This is the minimum RAM required for running basic and small programs, but as the size of an application increases, the memory requirement also increases for the application to run smoothly.

Step by Step Installation Of JDK

Before installing the latest JDK version, it is recommended to check our systems for any old JDK versions and uninstall them. Though we can have more than one JDK, it is easier to set paths and to work with just the latest one.

Step 1: Download JDK from the site

  • Go to the Oracle site and open the Java SE download page. Under the latest version of Java Platform, Standard Edition, click on the JDK download button.

How to install java

Next, click on the Accept License Agreement button and choose your version of Java for Windows (32-bit or 64-bit) to proceed with downloading the JDK executable file.

Step 2: Install the JDK exe file

  • In this step, we will be running the executable JDK file (It will be a file with .exe as an extension) once the download is done. This installs JDK as well as JRE. For running this file on Windows, we will need Administrator rights.
  • To begin the installation, we need to double-click on the downloaded file, and we will be presented with the below window.

How to install java

  • Click on Next to proceed with the installation, and follow the Installation guide provided for any queries.
  • Click on the Close button once the installation has finished.

How to install java

  • To recover some of our system’s disk space, it is good practice to delete the downloaded exe file once the download has been done.

Step 3: Check the directory

  • JDK gets installed in the C directory of our system by default having the path “C:\Program Files\Java\jdk-11.0”. If we make any change to this path at all, we need to make a note of it as it will be required in the upcoming steps.
  • This is the directory structure for our example.

How to install java

Step 4: Update the Environment Variables

  • We will need to update our system’s Environment variables with our installed JDK bin path to run the Java programs because while executing the programs, the command prompt will look for the complete JDK bin path.
  • The PATH variable in our system provides the exact location of executables that will be used for running Java programs, such as javac and java. The CLASSPATH variable provides us with the library files location.
  • If we do not set the PATH variable, we will specify the full path to the JDK bin every time we run a program.

For example: C:\> “C:\Program Files\Java\jdk-11.0\bin\javac” TestClass.java

  • So to set these variables, first right-click on My PC and select Properties.

How to install java

  • Inside Properties, in the left-side panel, select Advanced System Settings, and here choose the option Environment Variables.

How to install java

  • Click on New, and type PATH in the Variable Name, and enter the path of the bin of installed JDK in the Variable Value field.

How to install java

  • If we already have the PATH variable, we can edit it by adding it to the existing values.
  • Click on the OK button to apply the changes.

Step 5: Verify the Java Installation

  • Open the command prompt and enter the command “java –version”, and if it runs successfully, Java has been successfully installed.
  • Now that we have seen the steps to install JDK, let the programming fun begin!

Recommended Articles

This has been a guide to the installation of JDK. Here we discuss the basic concept, prerequisites, and different steps to install JDK. You can also go through our other suggested articles to learn more –

The Oracle GoldenGate Director software and installer both rely on components in the Java Runtime Environment (JRE). In many cases, this environment already exists because it was installed when the system was configured or when another program was installed. If the system where you are installing the server or client components does not have this environment, follow these instructions to download the JRE and verify the JRE environment on UNIX and Windows systems to support Oracle GoldenGate Director.

See System Requirements for the supported JRE versions.

Downloading the Java Runtime Environment

You can download the JRE free of charge from Oracle.

Under Java Platform, Standard Edition, select either the current release, or click Previous Releases to install an earlier supported version. You can use either the JDK or JRE. The JDK includes the JRE. Do not use any non-supported version or edition of the Java JRE or JDK.

Follow the navigation aids to download the JRE or JDK that is appropriate for your operating system.

Follow the installation instructions that are provided with the JRE.

Save the path to the JRE executable file. You will need it later.

Proceed to the instructions in Verifying the JRE Environment.

Verifying the JRE Environment

This section contains instructions for verifying the JRE environment on UNIX and Windows platforms.

Verifying the JRE on UNIX

After installing the JRE, run the following test to verify the version of Java that is recognized by the system.

From the command shell of the operating system, issue the following command.

Make certain the command output shows the version that you downloaded.

Verifying the JRE on Windows

After installing the JRE, but before installing Oracle GoldenGate Director Server, verify the path to the JRE by completing the following tasks:

Verify the JRE Version

These steps verify the JRE version that is installed on the server machine.

On the keyboard, press the Win (Windows) key and the R key simultaneously to open the Run box. Alternatively, you can select Start , then Run .

In the Run box, type cmd to run the Windows command console.

Issue the following command:

Do one of the following:

If the results show the JRE cversion that you installed, continue to the instructions in Installing Oracle GoldenGate Director Server.

If the results do not show that version, close the command console and continue with the steps in Set the JAVA_HOME System Variable.

Set the JAVA_HOME System Variable

These steps verify that the JAVA_HOME system environment variable points to the JRE that you installed, or creates the variable if absent.

On the desktop (Windows 2000) or in the Start menu (Windows XP), right-click My Computer and then click Properties .

Click the Advanced tab, and then click Environment Variables .

Under System Variables , look for the JAVA_HOME system variable. The JAVA_HOME path should point to the location that you recorded when you installed the JRE.

Do one of the following:

If you see the JAVA_HOME system variable and it points to the correct location, leave the Environment Variables dialog box open and follow the instructions in Set the JAVA_HOME System Path.

If a JAVA_HOME system variable does not exist, or if it points to the wrong location, continue to the next step.

Under System Variables , do one of the following:

Click New to create a JAVA_HOME variable.

Select the existing JAVA_HOME variable and then click Edit . This opens a dialog box to edit this variable.

In the Variable Name box, type JAVA_HOME in capital letters.

In the Variable Value box, type the correct path to the JRE.

Click OK to set the path and close the dialog box.

Leave the Environment Variables dialog box open and follow the instructions in Set the JAVA_HOME System Path.

Set the JAVA_HOME System Path

These steps ensure that the JAVA_HOME path is in the expected location within the Path system variable. Programs such as the Oracle database software place the path to their own JRE installations in the location that is expected by Oracle GoldenGate Director Server.

In the Environment Variables dialog box, look for the Path variable under System Variables .

Confirm that the path to JAVA_HOME appears as the first path in the list of paths.

Do one of the following:

If this JAVA_HOME path is the first path in the string, close the Environment Variables and System Properties dialog boxes and follow the instructions in Installing Oracle GoldenGate Director Server.

If this JAVA_HOME path is not the first path in the string, continue to the next step.

Under System Variables , double click the Path variable to open it for editing.

In the path string, locate the JAVA_HOME path. If it is there, cut and paste it (including the terminating semi-colon) to the front of the list; otherwise, type it. The path must be entered as %JAVA_HOME%\bin .

Learn to install Java on 64 bit Windows machines in this step-by-step guide.

1. Navigate to the Oracle Java Download Page

Navigate to the Java download page for the latest Java release.

Click on the link “JDK Download”.

How to install java

JDK Download Link

2. Download the zip or exe Package

Here you have two choices:

2.1. Windows x64 Installer

An .exe file which installs the Java in your 64-bit windows machine and makes all necessary environment entries.

For a normal user, it is the best approach.

2.2. Windows x64 Compressed Archive

A .zip file distribution which you can copy to any location the computer. In this case, you need to update all the required environment variables (e.g. PATH, JAVA_HOME, etc.) yourself.

It is best suited for Java developers who want to keep multiple versions of Java running on their computers.

After clicking any of the download links, a popup will appear to accept Oracle Technology Network License Agreement for Oracle Java SE in order to download this software. Click on the checkbox and then proceed to download it.

Login to the oracle website if prompted.

3. Installation with .exe File

If we are installing the Java software with the exe file downloaded in the previous section, follow the given steps.

Step 1. Double click on exe file to initiate the installation process

How to install java

Step-1

Step 2. Select Java installation location

Until you have a reason to change the location, let it be the default location.

How to install java

Step-2

Step 3. Begin Java Installation

Click on Next button and it will install Java in your 64-bit computer. After the process complete in a few minutes, the installation wizard will end with a success message.

How to install java

JDK Installation Finished

4. Installation with .zip File

This process is more suited for the Java developers community. Using this process, you can have multiple versions of Java on your computer. So based on the project requirements, you can choose a different version of any of the projects.

Step 1. Extract the zip archive in desired location

I have unzipped the jdk-14.0.2_windows-x64_bin.zip file in this location: E:\devsetup\jdk-14 .

How to install java

Unzip the file in desired location

Step 2. Add/Update the environment properties

To find the environment properties window, look for it in the control panel. Or in Windows 10, directly search it in the search box in the taskbar.

How to install java

Find environment variables

Add the JAVA_HOME variable and specify the folder path as value, where you unzipped the downloaded Java package.

How to install java

Add JAVA_HOME

Now update the PATH variable. Add a new path in the list which is the bin folder inside the JDK folder.

How to install javaThe PATH Variable to Edit How to install javaUpdate PATH variable

After both variables are updated, we can validate the Java installation.

5. Verify Java Installation

To verify that Java has been installed on your computer, open a new command prompt. Type the below command which will print the version of Java installed on your computer.

The command output.

If you get any error in running this command, verify all the steps listed above.

In this article, I show you exactly how to download and install Java for Minecraft. Whether you are looking to start a Minecraft server, play Minecraft mods, or just play Minecraft in general, you will need to download Java, and this article shows you every step of getting Java setup and running for Minecraft. The reason you need Java for basically everything to do with Minecraft is actually pretty simple. Minecraft is coded 100% in Java. Thus, you need Java to do everything when it comes to Minecraft, so let’s go ahead and get into download and install Java for Minecraft.

How to install java

Step 1) Download Java for Minecraft

Step one of getting Java is, well, downloading Java. This process is very simple and very easy. Just click on the big yellow button above, or this link to be taken off to the Java SE Development Kit download page! Once you are there, the process is very easy. Find the version of Java you want to install, the Windows version is the ‘Windows x64 Installer’ version at the bottom of the list. Click the blue download link next to this version. Your download will then begin. You may need to keep or save the file depending on your browser. It is 100% safe.

How to install java

Step 2) Install Java for Minecraft Servers & Mods

Now that you have downloaded Java, you need to get Java installed. Luckily, installing Java is very simple and just like installing any other program. First things first, double click on the Java Development Kit (JDK) file you downloaded. This will open the ‘Java SED Development Kit – Setup’ program. Once it has opened, click the ‘Next’ button in the bottom right. Click next again, and the Java JDK will then beginning installing.

Step 3) Make Sure Java Is Working

Once you have Java downloaded, you need to make sure it is working. You can do this by either opening Minecraft, trying to open your sever.jar, run Forge, Optifine, or whatever Minecraft mod you are trying to install! If it works, you’re all done. If not, you may need to run the Jarfix. Which you can download from this page. If you were still having issues, that should fix them on up! It will basically reconnect all of your .jar files to Java on your computer. Nevertheless, enjoy your newly downloaded Java!

If you have any questions or issues, please be sure to post in the comments below. We are more than happy to help you out, and assist you in the getting Java up and running properly!

As a highly popular programming language, Java is used for developing anything from lightweight mobile to desktop applications.

This step-by-step guide will show you how to install Java on CentOS 7.

How to install java

Note: These installation instructions apply for CentOS7 as well as versions 6 and 6.5, RHEL, and recent Fedora releases. For a dedicated Fedora guide, please refer to How To Install Java On Fedora.

  • A user account with sudo privileges
  • Access to the command-line/terminal window
  • The yum package manager, included by default

Java Versions

Currently, there are four Java platforms available:

  1. Java Standard Edition (Java SE)
  2. Java Micro Editions (Java ME)
  3. Java Enterprise Edition (Java EE)
  4. JavaFX

In this document, we look at different packages within the Java SE.

There are two (2), open-source Java packages, Java Development Kit (Open JDK) and Java Runtime Environment (Open JRE). You use JRE for running Java-based applications, while JDK is for developing and programming with Java.

Also available is Java Oracle, another SE implementation, which has additional commercial features. You can find the official Oracle JDK through a third-party repository or on the official Oracle webpage. However, bear in mind its license only allows non-commercial use of the software.

Install Java On CentOS

You can install one or several Java packages on your machine. You can also decide which version you want on your system by installing a specific version number. The current default, Long-Term-Support (LTS) version is Java 11.

Install OpenJDK 11

1. Update the package repository to ensure you download the latest software:

2. Then, install the Java Development Kit with the following command:

The output displays the downloaded and installed JDK, as in the image below:

How to install java

Install OpenJRE 11

Java Runtime Environment 11 (Open JRE 11) is a subset of OpenJDK. Therefore, both packages are included in the command:

Install Oracle Java 11

1. The official Oracle JDK is not available for download from the local repository. You have to download the .rpm package from the Java SE Downloads page.

2. The latest release is Java SE 12. However, Oracle Java 11 is LTS, meaning it is the latest stable version.

Locate Java SE 11.0.3 (LTS) on the webpage and click on DOWNLOAD.

How to install java

3. After the download is complete, you can install the package with the command:

Verify Java is Installed on Your System

The following command shows which Java release you have and confirms installation was successful:

If Java was successfully downloaded and installed, the output details should match the image below:

Install Specific Version of Java

You can also install any of the other versions of Java by changing the version number in the command.

Install JDK 8

You may decide to use Open JDK 8, instead of the default OpenJDK 11.

To do so, type in the following command in the terminal:

Install JRE 8

As a subset of Open JDK 8, you can install Open JRE 8 by typing in the command:

Install Oracle Java 12

As previously mentioned, you have to download Oracle Java from its official page.

To install the newest version, simply download the appropriate package from their webpage and continue with the installation.

How to Set Default Java Version

Since you can have multiple versions of Java installed on your system, you can decide which one is the default one. To do so;

Run a command that shows all the installed versions on your computer:

How to install java

The image above shows that there are two alternatives to this system. These choices are represented by numbers 1 (Java 11) and 2 (Java 8).

To change the default version, type the associated number (in this case, 1 or 2) and press Enter.

How to Set JAVA_HOME Environment Variable

Setting the JAVA_HOME environment variable helps other applications compiled in this programming language to access Java’s installation path easily.

1. First, locate where Java is installed:

How to install java

In the output, you can find the path for each Java package installed on the system.

  • /usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64/bin/java (where OpenJDK 11 is located)
  • /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java (where OpenJDK 8 is located)

2. Once you see all the paths, copy the one of your preferred Java version.

3. Then, open the .bash_profile with any text editor. In this example, we use vim:

4. At the bottom of the file, add a line which specifies the location of JAVA_HOME in the following manner:

For example, if we copy the installation path for Java 11 in the previous step, the added line in the text editor will be:

How to Uninstall Java on CentOS

In case you need to remove any of the Java packages installed, use the yum remove command.

For example, to remove Open JDK 8 use the following command:

Confirm the process by pressing y (yes), and it will uninstall the package from CentOS, as in the image below:

How to install java

In this tutorial, you have learned how to install Java on CentOS 7.

We also covered changing the default version and setting the home environment variable. You are now ready to get started with Java!

If you are using a newer version of CentOS, check out our article on how to install Java 8 & 11 on Centos 8.