How Do I Switch to OpenJDK

I am looking to update our application to use OpenJDK version 11 instead of Java 1.8.*

I installed OpenJDK 11, but unsure how to change config so it begins using it now.

I originally installed using installation package at version 5.2.5.20. JAVA_HOME is empty, so guessing configuration is using a set path potentially? Looked to maybe set all the java paths and see if it changes it but wanted to get some input before doing so on what might be best practices.

System Info:
OS: Oracle Linux 7.*
Java Version: 1.8.0_181 (Oracle Corporation) 64bit
Tomcat Version: Apache Tomcat/8.5.42
Lucee Version: Lucee 5.3.6.61

Quick question here as I posted separately and have not heard anything back. If we used the installer initial to setup lucee in a Oracle Linus environment, it used Oracle java 8. But I am working to update it to run OpenJDK 11 and have installed it using yum. (yum install java-11-openjdk) How do I now tell lucee to use OpenJDK instead of Oracle? JAVA_HOME is empty on my current install and if I add it, Lucee still uses Oracle.

Hi Grant,

If you’re using the installer, the control script is called lucee_ctl. There is one present in the /opt/lucee directory and likely in your /etc/init.d/ directory. Open this up in your favorite text editor and change the JRE_HOME/JAVA_HOME variables at the top.

Restart, and assuming restarting with a new JRE goes okay, you’re set.

Hope this helps!

Thanks Jordon,

Since I am trying to switch to use OpenJDK and no JRE folder exists, what path should be there?

Grant

Hey Grant,

I believe it’s specifically looking for whatever directory has your /bin and /lib folders for java. That can vary I suppose.

For the record, the latest Installers include the OpenJDK JRE from https://adoptopenjdk.net/. So, they’re both going to be OpenJDK! Just different versions. One from your OS and the other from Adopt. =)

Hope this helps!

-JM

1 Like

Can get running now fine using OpenJDK 8. However running into several issues with Lucee starting using OpenJDK 11. At least here I can get current updates installed, but would like to plan an update to version 11 at some point in the future.

What issues?

When using OpenJDK 11 and pointing JRE and JAVA home to that path Lucee will not start and errors out with following error. I was unable to find much info to help me determine how to resolve.

JRE_HOME=/usr/lib/jvm/java-11-openjdk-11.0.7.10-4.0.1.el7_8.x86_64; export JRE_HOME
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.7.10-4.0.1.el7_8.x86_64; export JAVA_HOME

ERROR:

-Djava.endorsed.dirs=/opt/lucee/tomcat/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

It would appear you have an older installation of Lucee that you’ve been upgrading in place. It seems the installer has changed over the years to better support java 10+

You can try to follow Bruce’s instructions on modifying the Lucee start script, but I would recommend considering a fresh installation of Lucee for your server to get a clean slate. it will come with OpenJDK 11 as well.

1 Like

Thanks for that info… I think I will just stay with OpenJDK 8 for this release on our application and look at doing a fresh install in a future update of our platform.