Some JSCAPE MFT Server customers are looking to migrate to OpenJDK distributions in order to avoid the Oracle Java paid subscriptions. JSCAPE MFT Server readily supports OpenJDK, so you won't lose any of its capabilities when you do an Oracle JDK to OpenJDK migration. In this post, we'll show you just how easy it is to do such a migration on a Linux host.Before you perform any Java migration, you might want to check first if you're actually using Oracle Java on your Linux host. One way to do that is by running this command on your Linux terminal:
An output that says Java (TM) ... is an indication you're using Oracle Java.
There's a hitch though. Some machines can sometimes be running multiple versions and flavors of Java, so that output doesn't necessarily mean you're using Oracle Java to run your JSCAPE MFT Server instance. It only means it's the one Linux is configured to use by default.
To know for certain which version/flavor of Java your MFT Server instance is running on, you can check its server0.log file. Go to your JSCAPE MFT Server installation directory. In most cases, it's going to be in your /opt directory.
After that, navigate into the ./var/log directory and open the server0.log file.
Scroll down to the part where it displays the JRE and JVM versions. You'll find those entries right before the part where it says "Server test completed...".
If the log entries match the output of the java -version command and the output of that command indicated an Oracle Java JRE/JVM, then that means your MFT Server instance is running on Oracle Java.
We'll now walk you through the steps of migrating from Oracle Java to OpenJDK. In this particular example, we'll be using an OpenJDK distribution from Amazon known as Amazon Corretto. As indicated in their website, Amazon Corretto is a free, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK).
The latest version as of this writing is Corretto 11, so let's try that. Go to the download page, and download a suitable installer. I'm using Red Hat Linux, so I'll download the rpm installer.
I'm connecting to my Linux host from my laptop via SSH, so I just copied the rpm link and ran it with the wget command like so:
sudo wget [link to rpm installer download]
Once the download completes, install the the rpm file using the yum localinstall command.
sudo yum localinstall [name of downloaded rpm]
After the installation completes, the next step is to determine the path of the home directory of this new Java installation. The easiest way to do that is to run this command:
rpm -ql [name of the rpm file minus the .rpm extension]
Next, find the path that precedes the /bin directory. So, here, in my set up, it's:
Take note of that path.
You're supposed to enter that path into the 'server' script found inside the JSCAPE MFT Server installation directory. So, here, I'm opening that file with vim.
Look for the line that says: INSTALL4J_JAVA_HOME_OVERRIDE
Uncomment that line and enter the path you took note of earlier. In my case, it would read:
Save the file and restart the JSCAPE MFT Server using the restart_service.sh script in the MFT Server installation directory.
After a few seconds, you can verify if the Java migration succeeded by opening the server0.log file, scrolling down near the bottom, and checking if the JRE and JVM versions now match the version of the newly installed OpenJDK distribution.
Since I'm using Corretto 11, this means my migration was a success.
That's it. Now you know how to migrate from Oracle Java to OpenJDK on a Linux host.