Upgrading Java on Windows

Modified on Wed, Mar 12 at 2:37 PM

Upgrading Java on Windows

About Java

Genesis runs on the current version of Oracle JDK 21 (Java Development Kit).   Do not attempt to use Genesis with any other version of Java.

Overview of JDK Upgrade

  • Shutdown Apache Tomcat services
  • Uninstall current JDK
  • Install new JDK
  • Update Environment Variables
  • Update Tomcat JVM path
  • Start Apache Tomcat services

Determine the current version of Java

Open a command prompt, and type this command in:

 C:\Users\Oracle> java -version
java version "21.0.3" 2022-04-22 LTS
Java(TM) SE Runtime Environment (build 21.0.3+2-LTS-6)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+2-LTS-6, mixed mode, sharing))

In the above example; the version of Java is: 21.0.3

Determine where it is installed

Open a command prompt; and type this command in:

 C:\Users\Oracle> echo %JAVA_HOME%
c:\jdk-21.0.3

Download the current version of Java 21

The current version of Java JDK 21 can be downloaded at this link:

https://www.oracle.com/java/technologies/downloads/

Select Java 21 and Windows OS and download the x64 MSI installer shown in the following screen shot:

  A screenshot of a computer

Description automatically generated

Uninstall the Current version of JDK

First, you will want to shut down Apache Tomcat services.

Open services.msc > Stop service “Apache Tomcat” and “SchoolFi” (if they are hosted on the same server)

If the services cannot shut down, open a CMD Prompt window. Run as administrator and run these commands.

taskkill /f /im tomcat10.exe

taskkill /f /im schoolfi.exe

 

Next Uninstall current JDK

Open Add or Remove Programs > Uninstall current JDK version

A screenshot of a computer

Description automatically generated

 

Installing the new version of JDK 21

Next, Run the installer that was downloaded in the previous step. The following screenshots show the new version that we just downloaded: 21.0.4.

Click the Change button

A screenshot of a computer

Description automatically generated

A screenshot of a computer

Description automatically generated

Change the path name to be similar to where the previous version was installed.   On most Windows servers; Java is installed on the C drive.

Example:

Default Path : C:\Program Files\Java\jdk-21\

Change Path: C:\jdk-21\

(choose the same disk drive that of the previous JDK)

 

Click the next button.

The new version of Java is now installed.

Update Environment Variables

Now that the new JDK is installed on the server, we need to configure Genesis and the Upgrade scripts to use it.

First, we need to update two system environment variables. The following screen can usually be found by right-clicking on  This PC (My Computer) and selecting Properties.

Go to the Advanced system settings area; and then click on the Environment Variables button. 

The following screen shots are from Windows 11 and may differ slightly in other versions of Windows.


In the System Variables section; click New 

Variable name: JAVA_HOME 

Variable Value: C:\jdk-21\ 

A screenshot of a computer program

Description automatically generated

(if the JAVA_HOME System variable already exists, simply edit the path of the variable to the new location)


The same will be done with the Path variable.

Under System Variables select Path > click Edit Button.

In the Path environment variables editor (screenshot below), click New and enter the JDK Binary directory path.

C:\jdk-21\bin

A screenshot of a computer

Description automatically generated

Close all open command prompts. 

Update Tomcat

Apache Tomcat needs to be updated with the new version of Java.

Typically Tomcat settings can be found under:

C:\tomcat_genesis\bin\tomcat10w.exe

C:\tomcat\bin\schoolfiw.exe

A screenshot of a computer

Description automatically generated

Edit the Java Virtual Machine Path

C:\jdk-21.0.4\bin\server\jvm.dll

A screenshot of a computer

Description automatically generated


Click the Apply > OK buttons to save the changes.

Testing the Java installation

Is new version of Java installed?

Open a new command prompt. 

Enter the following command to ensure that the new version of Java is installed

C:\> java -version
 
java version "21.0.4" 2022-04-22 LTS
Java(TM) SE Runtime Environment (build 21.0.4+2-LTS-6)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.4-LTS-6, mixed mode, sharing))

The new version should be reported.

Is JAVA_HOME updated?

C:\>echo %JAVA_HOME%
c:\jdk-21

The path to the newly installed Java should be reported.

Start Apache Tomcat

Open services.msc > Start service “Apache Tomcat” and “SchoolFi” 

Or from CMD Prompt > Run as administrator execute these commands

net start tomcat10

net start schoolfi

Verify Java version within Genesis

Log into Genesis as an administrator, and go to the Core.Diagnostics.Config screen.

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article