How to manually enable the latest Java version on Windows systems

Java is a computer programming language that is found on desktops to servers to mobile devices and also smart cards. The Java application runs on most of the systems including Linux, Mac, and Windows. There are several uses where Java is being applied like playing online games and viewing 3D images. Additionally, they also play a role in e-business solutions for corporate computing, and so on. Java is a popular program in the IT sector where they use a Java-based server solution that is deployed on servers. Moreover, the Java that is deployed on servers is relatively safer as compared to using Java on desktop systems. Java may also be required to open a website or run a program.

While it’s not recommended to use Java on your personal computer due to the security threat, in some unavoidable circumstances one may have to install Java to run a program or a webpage – and in such cases, one needs to take some precautions. It’s worth mentioning that in unavoidable situations like the one mentioned here, you should install Java from the official website only. It is also necessary that you keep the Java programs updated as it’s easy for intruders and hackers to compile the Java code that can infect most of the computers while surfing online.

Most of the user’s face trouble using Java on a Windows system, even after successfully installing them on the Windows system. If you have downloaded and installed Java but still not able to use it, then it’s possible that your browser has not enabled Java. This problem usually occurs if the user is already using another application that requires Java. In this case, the application vendors don’t want to change the browser settings, and a user has to manually enable the latest installed version of Java in the Java Control Panel. It is also a good practice to enable and use the latest version of Java to avail of the latest security patches and enhancements.

How to check Java version in Windows 11/10:

  • Click the Start button
  • Scroll through the applications and programs listed until you see the Java folder
  • Click on the Java folder
  • Open About Java to see the Java version.

In this article, we discuss how to install Java and manually enable the latest installed version of Java in the Java Control Panel

Manually enable the latest Java version on Windows 11/10

Downloading Java is easy, and users may require administrative privileges for Windows download and installation. There are two ways to install Java. Users can choose either to get Java through an online download or offline download from the official website – java.com.

Once the process starts, you may choose either Run or Save option for the download file from the File Download dialog box. Click Run to run the installer OR Click Save to save the file for later installation.

Choose the folder location and save the file to a known location on your computer. To start the installation process, Double-click on the saved file to run and install Java.

Using Java Control Panel in Windows 11/10

Go to Start and open Control Panel.

In the Control Panel, click on Java icon to open the Java Control Panel.

Now to enable the latest installed version of Java, open the Java tab. To open Java Runtime Environment settings click on View button.

Check the Enabled option to permit the latest Java Runtime version.

Click on OK button to apply the setting changes. Click OK in Java Control Panel to confirm the changes.

Now run the Java program embedded in the web browser (applet) to verify if the latest version of Java is installed in your computer.

That’s all.


— Update: 16-03-2023 — us.suanoncolosence.com found an additional article How to Change Java Versions in Windows
(Updated for Java 19 )
from the website www.happycoders.eu for the keyword enable the latest java version on windows system.

In this article, I will show you how to install multiple Java versions on Windows and how to change the Java version on the command line:

To enable these Java version change commands on your system as well, follow this step-by-step guide.

Let’s go…

Step 1: Installing Multiple Java Versions

Installing multiple Java versions in parallel is incredibly easy in Windows. You can download and run the installer for each version, which automatically installs the versions in separate directories.

Download Sources

  • Java SE 1.1 – You can no longer install this version on 64-bit Windows.
  • Java SE 1.2 – Installed to C:jdk1.2.2 and C:Program Files (x86)JavaSoftJRE1.2 by default – I recommend changing this to C:Program Files (x86)Javajdk1.2.2 and C:Program Files (x86)Javajre1.2.2 for the sake of clarity.
  • Java SE 1.3 – Installed to C:jdk1.3.1_28 by default – I recommend changing this to C:Program Files (x86)Javajdk1.3.1_28.
  • Java SE 1.4 – Installed to C:j2sdk1.4.2_19 by default – I recommend changing this to C:Program Files (x86)Javajdk1.4.2_19.

Starting with the following versions, you don’t need to change the default installation directories:

  • Java SE 5
  • Java SE 6
  • Java SE 7
  • Java SE 8
  • Java SE 9 / OpenJDK 9
  • Java SE 10 / OpenJDK 10 (→ The most important new features in Java 10)

Attention – you may use the following Oracle distributions only for private purposes and development:

  • Java SE 11 / OpenJDK 11 (→ The most important new features in Java 11)
  • Java SE 12 / OpenJDK 12 (→ The most important new features in Java 12)
  • Java SE 13 / OpenJDK 13 (→ The most important new features in Java 13)
  • Java SE 14 / OpenJDK 14 (→ The most important new features in Java 14)
  • Java SE 15 / OpenJDK 15 (→ The most important new features in Java 15)
  • Java SE 16 / OpenJDK 16 (→ The most important new features in Java 16)
  • Java SE 17 / OpenJDK 17 (→ The most important new features in Java 17)
  • Java SE 18 / OpenJDK 18 (→ The most important new features in Java 18)
  • Java SE 19 / OpenJDK 19 (→ The most important new features in Java 19)

The following version is currently an early access build. You should use it only for testing purposes:

  • JDK 20 Early-Access Build (→ The most important new features in Java 20)

Step 2: Define Java Environment Variables

The following two environment variables decide which Java version an application uses:

  • JAVA_HOME – many start scripts use this variable.
  • Path – is used when running a Java binary (such as java and javac) from the console.

These variables should always point to the same Java installation to avoid inconsistencies. Some programs, such as Eclipse, define the Java version in a separate configuration file (for Eclipse, for example, this is the entry “-vm” in the eclipse.ini file).

Manually Setting the Java Environment Variables

The Java installers create various environment variables, which you need to clean up first (see below). The fastest way to change the environment variables is to press the Windows key and type “env” – Windows then offers “Edit the system environment variables” as a search result:

Opening Windows environment variables

At this point, you can press “Enter” to open the system properties:

Windows 10 System Properties

Click on “Environment Variables…” and the following window opens:

Windows environment variables Java 19

As the default version, I recommend the current release version, Java 19. Accordingly, you should make the following settings:

  • The top list (“User variables”) should not contain any Java-related entries.
  • The lower list (“System variables”) should contain an entry “JAVA_HOME = C:Program FilesJavajdk-19”. If this entry does not exist, you can add it with “New…”. If it exists but points to another directory, you can change it with “Edit…”.
  • Delete the following entries under “Path” (if they exist):
    • C:ProgramDataOracleJavajavapath
    • C:Program Files (x86)Common FilesOracleJavajavapath
  • Insert the following entry instead:
    • %JAVA_HOME%bin

The entry should then look like the following (the other entries in the list will probably look different for you since you have other applications installed than I do):

Adding “%JAVA_HOME%bin” to the “Path” system variable

The last entry ensures that Path and JAVA_HOME are automatically consistent.

Attention: this only works for the default setting configured here. If you change JAVA_HOME via the command line, you have to adjust Path accordingly. But don’t worry – the scripts you can download in the next step will do that automatically.

How to Check Your Java Version on Windows

Now open a command line to check the settings with the following commands:

Code language: plaintext (plaintext)

Here’s what you should see:

Check your Java version with “cmd”

Step 3: Install the Scripts to Change the Java Version

To change the Java version on the command line, I have prepared some batch files that you can copy to your system. Here is the link: scripts-up-to-java20-v2.zip

The ZIP file contains scripts named java20.bat, java19.bat, java18.bat, etc., for all Java versions, plus some common scripts starting with “javaX”. I suggest you unpack the scripts to C:Program FilesJavascripts.

The scripts look like this:

java19.bat:

Code language: DOS .bat (dos)

javaX.bat:

Code language: DOS .bat (dos)

javaX-JAVA_HOME.bat:

Code language: DOS .bat (dos)

The scripts update the JAVA_HOME environment variable and insert the bin directory at the beginning of the Path variable. That makes it the first directory to be searched for the corresponding executable when you run Java commands such as java or javac.

(The Path variable gets longer with each change. Do not worry about it. This only affects the currently opened command line.)

Step 4: Add the Script Directory to the Path

To be able to call the scripts from anywhere, you have to add the directory to the “Path” environment variable (just like you did with “%JAVA_HOME%bin” in the second step):

Adding “C:Program FilesJavascripts” to the “Path” system variable

If you have installed the latest releases of all Java versions, you can use the scripts without any further adjustments. Open a new command line and enter, e.g., the following commands:

Changing the Java version

If one of the commands does not activate the expected Java version, please check if the path in the javaX-JAVA_HOME.bat file corresponds to the installation path of the Java version you want to activate.

Temporary, Permanent, and System-Wide Java Version Changes

The commands presented up to this point only affect the currently opened command line. As soon as you open another command line, the default version defined in step 2 is active again (Java 19, if you have not changed anything).

That is why there are not one but three scripts for each Java version:

  • java: Activates the Java version in the current command line.
  • java-user: Sets the Java version as the default version for your user account.
  • java-system: Sets the Java version as the default version for the entire system-

The -user variants of the scripts additionally set the JAVA_HOME environment variable with the setx command, permanently writing the change to the registry:

java19-user.bat:

Source: us.suanoncolosence.com

Code language: DOS .bat (dos)

javaX-user.bat:

Code language: DOS .bat (dos)

The -system variants also specify the /M parameter in the setx command. This sets the system-wide environment variable instead of the user-specific one:

java19-system.bat:

Code language: DOS .bat (dos)

javaX-system.bat:

Code language: DOS .bat (dos)

Attention: To set the system-wide Java version, you must open the command line as an administrator. Otherwise, you will get the error message “ERROR: Access to the registry path is denied.

What You Should Do Next…

I hope you were able to follow the instructions well and that the commands work for you.

Now I would like to hear from you:

Were you able to follow the steps well – or do you have unanswered questions?

Either way, let me know by leaving a comment below.


— Update: 20-03-2023 — us.suanoncolosence.com found an additional article How to Install Java on Windows from the website phoenixnap.com for the keyword enable the latest java version on windows system.

Introduction

The Java Development Kit (JDK) is software used for Java programming, along with the Java Virtual Machine (JVM) and the Java Runtime Environment (JRE). The JDK includes the compiler and class libraries, allowing developers to create Java programs executable by the JVM and JRE.

In this tutorial, you will learn to install the Java Development Kit on Windows.

Prerequisites

  • A system running Windows 10.
  • A network connection.
  • Administrator privileges.

Check if Java Is Installed

Before installing the Java Development Kit, check if a Java version is already installed on Windows. Follow the steps below:

  1. Open a command prompt by typing cmd in the search bar and press Enter.
  2. Run the following command:
java -version

The command outputs the Java version on your system. If Java isn’t installed, the output is a message stating that Java isn’t recognized as an internal or external command.

Download Java for Windows 10

Download the latest Java Development Kit installation file for Windows 10 to have the latest features and bug fixes.

Via @: us.suanoncolosence.com

  1. Using your preferred web browser, navigate to the Oracle Java Downloads page.
  2. On the Downloads page, click the x64 Installer download link under the Windows category. At the time of writing this article, Java version 17 is the latest long-term support Java version.

Wait for the download to complete.

Install Java on Windows 10

After downloading the installation file, proceed with installing Java on your Windows system.

Follow the steps below:

Step 1: Run the Downloaded File

Double-click the downloaded file to start the installation.

Step 2: Configure the Installation Wizard

After running the installation file, the installation wizard welcome screen appears.

1. Click Next to proceed to the next step.

2. Choose the destination folder for the Java installation files or stick to the default path. Click Next to proceed.

3. Wait for the wizard to finish the installation process until the Successfully Installed message appears. Click Close to exit the wizard.

Set Environmental Variables in Java

Set Java environment variables to enable program compiling from any directory. To do so, follow the steps below:

Step 1: Add Java to System Variables

1. Open the Start menu and search for environment variables.

2. Select the Edit the system environment variables result.

3. In the System Properties window, under the Advanced tab, click Environment Variables…

4. Under the System variables category, select the Path variable and click Edit:

5. Click the New button and enter the path to the Java bin directory:

6. Click OK to save the changes and exit the variable editing window.

Step 2: Add JAVA_HOME Variable

Some applications require the JAVA_HOME variable. Follow the steps below to create the variable:

1. In the Environment Variables window, under the System variables category, click the New… button to create a new variable.

2. Name the variable as JAVA_HOME.

3. In the variable value field, paste the path to your Java jdk directory and click OK.

4. Confirm the changes by clicking OK in the Environment Variables and System properties windows.

Test the Java Installation

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:

Step 1: Write a Test Java Script

1. Open a text editor such as Notepad++ and create a new file.

2. Enter the following lines of code and click Save:

class HelloWorld{	public static void main(String args[]){	System.out.println("Hello world!");	} } 

3. Name the file and save it as a Java source file (*.java).

Step 2: Compile the Test Java Script

1. In the command prompt, change the directory to the file’s location and use the following syntax to compile the program:

javac [filename]

For example:

After a successful compilation, the program generates a .class file in the file directory.

2. Run the program with the following syntax:

java [filename]

The output shows that the program runs correctly, displaying the Hello world! message.

Conclusion

This tutorial showed how to install the Java Development Kit on a Windows system. If you are interested in learning more about Java, read our list of 13 best Java IDEs for writing, debugging, and testing Java code.

Source: https://www.thewindowsclub.com/enable-the-latest-java-version-on-windows-system

Article post on: us.suanoncolosence.com

Leave a Comment

Your email address will not be published. Required fields are marked *