Updating Java is not fun

I’ve been using OpenSDK Java (Java 11) on my Ubuntu servers for a while now, so thought it would be a good idea to update Java on my main production machine.

After digging into “what’s the difference between OpenSDK and Oracle SDK”, I came to the conclusion the main difference was … nothing. Since it was a lot easier to find Oracle SDK for a Win 7 box, I chose that and downloaded the installer.

After installing… nothing. It was still pointing to the older version. I removed the older version(s) and still… nothing. I reinstalled and there was a “next steps” button which led to a help file that basically said “you must manually adjust the system PATH variable for Java to work”. Really? In 2019???

Oh well, it’s easy to do and afterward I did indeed have Java 11 running. I also updated my ‘go.bat’ script that sets up Java for command shell compiling, which is used by my production ant builds of my enterprise application.

Of course, the ant build failed, but I knew it would as the (very old) libraries were removed when I toasted Java 8.

And now came the messy part. I pointed CLASSPATH to the new (better) Tomcat location of the various servlet libraries, but still no good news. After much reading to little effect, I grabbed some of the code and tried compiling it in a shell window, which worked just fine. I had established that ant was not getting the CLASSPATH.

In the midst of this I upgraded Apache Ant to version 10 with no ill effect.

Again, after much more reading, it became clear that Ant actually and openly HATES the classpath variable and erases it when used. There was no functional work-around to this, so I reluctantly rewrote my build.xml files to embed a classpath for the application compiles. This worked, but showed more missing files.

I adjusted the Ant build until everything compiled, but it required a new ‘altlib’ directory of lesser-used jar files to fully work.

Finally, an almost-good compile. There were only a few remaining errors, but they ended up costing me time. All errors amounted to the removal of “com.sun” libraries. One was found in apache.commons, and the other was so deprecated that the advise just said “comment it out”. I did, and everything compiled successfully.

Now I’m running on Java 11 and Ant 10 with what is considered a “proper” build link to libraries. I disagree but there’s little I can do.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.