Blog

Managed File Transfer and Network Solutions

Oracle JDK to OpenJDK Migration on Linux | JSCAPE

Posted by John Carl Villanueva on Mon, Dec 09, 2019 @ 07:13 AM

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:

java -version

An output that says Java (TM) ... is an indication you're using Oracle Java. 

 

java -version in linux-1

 

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.

 

view server0 log

 

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. 

 

java version in server0 log-1

 

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. 

 

download amazon corretto 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]

 

download wget amazon corretto

 

Once the download completes, install the the rpm file using the yum localinstall command.

sudo yum localinstall [name of downloaded rpm]

 

sudo yum localinstall amazon corretto

 

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]

 

rpm ql amazon corretto

 

Next, find the path that precedes the /bin directory. So, here, in my set up, it's:

/usr/lib/jvm/java-11-amazon-corretto/

Take note of that path.

 

rpm ql java location

 

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.

 

sudo vim server-1

 

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:

INSTALL4J_JAVA_HOME_OVERRIDE=/user/lib/jvm/java-11-amazon-corretto/

 

install4j_java_home_override

 

Save the file and restart the JSCAPE MFT Server using the restart_service.sh script in the MFT Server installation directory.

 

restart mft server

 

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. 

 

jre jvm of amazon corretto 11

 

That's it. Now you know how to migrate from Oracle Java to OpenJDK on a Linux host. 

Topics: JSCAPE MFT Server, Managed File Transfer, Tutorials, Java