Upgrade Java on Windows server

Upgrade of Java on Windows server can done by following the steps below:

Step-by-step guide

On Windows:

  1. Install the new Java version on the server.

  2. Set up a system wide new JRE_HOME and JAVA_HOME environment variables

    Set the JRE_HOME environment variable so it refers to the Server JRE's jre directory (e.g. JRE_HOME=C:\Program Files\AdoptOpenJDK\jdkX.X.X_NEW\jre)
    Set the JAVA_HOME environment variable so it refers to the Server JDK's home directory (e.g. JAVA_HOME=C:\Program Files\AdoptOpenJDK\jdkX.X.X_NEW)
  3. Environment variables can be set Control Panel → System and Security → System → Advanced system settings → Environment Variables → System Variables → New...


Issue

Even after following above steps you may observe issue when starting ubilogin server, it doesn't startup and following errors are observed in catalina.logs:

catalina logs
[error] [12656] Failed creating java C:\Program Files\AdoptOpenJDK\jdkX.X.X_OLD\bin\server\jvm.dll

Sometimes attempts to uninstall specific versions of Java, leaves behind some Java entries in the registry that are not fully removed. Due to which above error is observed as the ubilogin server windows services still refers to the OLD java version. 

Solution

Option 1:

You need to remove the old ubilogin windows services and re-install it.

You can use following scripts:

Stop the ubilogin server and Ubilogin Accounting: 
net stop ubiloginserver
net stop ubisecureaccounting

cd "C:\Program Files\Ubisecure\ubilogin-sso\ubilogin\config\tomcat"

remove.cmd - Removes the Ubilogin server and accounting service
install-service.cmd - Installs the Ubilogin server and accouting service

Note

Before you run remove.cmd, ensure you still have the old java version on server, else script will fail.

Option 2:

Ensure you have successfully uninstalled the old java version. If not, you would need to clean-up the registry.

Follow steps from mentioned in document, to clean-up the registry: https://java.com/en/download/help/manual_regedit.html