TSTool / Update Java / Overview
This documentation describes the steps needed when updating the Java version.
Introduction
TSTool is written in the Java language and is developed using the Eclipse IDE, which runs Java. Java is a mature language but continues to be enhanced over time. The Java development tools must also be updated to be compatible with newer operating systems. This documentation summarizes steps that were taken to update Java from one version to another.
Update Java from Version 8 to 11
Java 8 was used for many years due to its stability. TSTool was updated to use Java 11 in 2025 and the plan is to update TSTool to newer long-term support (LTS) releases every several years to ensure that TSTool's version of Java is up to date.
Updating the version from 8 to 11 required a number of basic changes,
including handling simple version number like 11 whereas previously 1_8 or 18 was used
due to Java historical version conventions.
The following steps were taken to update an existing development environment from Java 8 to 11. The developer documentation was updated as software was updated.
- Backup files:
- Copy the entire
TSTooldevelopment folder with all local repository working files to a backup folder. These files will only be used for comparison as necessary and can be removed in the future.
- Copy the entire
- Install Java 11:
- OK to leave Java 8 if it exists because it may be used by other software (can remove later).
- Install Eclipse 2022-06, which is the last Eclipse version that runs with Java 11:
- Make sure that the Eclipse version is compatible with the Java version used with Eclipse. Otherwise, an error may result that is difficult to troubleshoot.
- OK to leave 2019-03 if it exists because it may be used by other software.
- Update the Eclipse run script to use the latest Eclipse and Java:
build-util/run-eclipse-win64.cmdbuild-util/run-eclipse.bash
- Update the runtime scripts:
- Update the
resources/runtime/bin/tstoolscript to run on Linux using Java 11 or later.
- Update the
- Update the Linux distribution build scripts:
- Update the
resources/runtime/bin/build-linux-distro.bashscript to use Java 11
- Update the
-
Run Eclipse:
- Use the
build-util/run-eclipse-win64.cmdscript in a Windows command shell.- It should find the Exclipse 2022-06 version.
- If an error dialog is shown, try running the
eclipse.exeprogram in the Eclipse installation folder (cancel before opening the workspace). - If the above works but still have an error from the run script, try editing the run script to add other command line parameters until the problem is identified.
-
A warning may be shown as follows. Press Continue to update the workspace configuration.
Older Workspace Version Warning (see full-size image)
-
A dialog may be shown as follows to update Eclipse plug-ins. In this case, the Vrapper plug-in was previously installed to provide "vim" editor behavior within Eclipse. Press Next > to update the plugins that are listed. Additional confirmation steps may occur.
Plugin Import Wizard (see full-size image)
-
Eclipse will rebuild the projects and may prompt to restart to apply the software update. Pressing Restart Now to continue may not properly restart. Restart Eclipse using the run script.
- Use the
-
Additional Eclipse configuration:
- The Java software and Java compatibility version need to be updated to Java 11. See the New Developer Setup / Overview / Additional Eclipse Configuration documentation.
-
Code changes:
-
The following project changes were made:
Project Change cdss-lib-satmonsys-javaDelete from the workspace since it is legacy code and is no longer used. -
The following specific code changes were made. After the changes, approximately 1,170 warnings remain (reduced from over 3,500 after initial updates, with most being in UI-related code that requires more paramaterization for data lists. The code is OK for now and can be clarified as maintenance is performanced. Issues that seem more problematic have been added to repository issues to increase visibility for maintenance.
Package Class Change DWR.StateModStateMod_NodeNetworkandStateMod_Network_JFrameUse new XML parsing classes. RTi.GRGRCanvasDrawingAreaRemove import of the sun.font.FontManagerFactoryclass since no longer available and import is not needed.RTi.GRTSTSGraphJComponent_SaveAsSVGThe code has issues with the w3c class conflicts. Disable Batik since a JFreeChart version that is stand-alone is enabled. RTi.Util.IOSecurityCheckRemove the canCheckAWTEventQueue()andcanUseClipboard()methods since not used and has unsupported code.RTi.Util.IOXmlToolkitSee the RccAcisDataStoreissue below. Fix by using thexmlbeans-2.3.0-fixed.jarlibrary dependency. Also use thejython-fixed.jar, withw3cclasses removed.rti.tscommandprocessor.commands.emailSendEmailMessageClasses javax.activation.DataHandler,DataSource, andFileDataSourceare no longer available. Replaced withjakarta.activation.DataSource, etc. and add thelib/jakarta-activation/jakarta-activation-api-2.1.3.jarlibrary dependency.rti.tscommandprocessor.commands.rccacis
and othersRccAcisDataStoreThe code uses org.w3c.domclasses to parse XML. These are built-in classes. Thexmlbeans-2.3.0.jarfile that is used with the Apache POI library to read and write Excel also inclduesorg.w3c.dom. See the fix below.rti.tscommandprocessor.commands.waterml2WaterML2ReaderThe javax.xml.bindpackage is not available in Java 11. A separate library is available on Maven Central and is installed aslib/jaxb-api/jaxb-api-2.3.1.jar. Glassfishjaxb-runtime-2.3.2.jaris also needed to marshal and unmarshall files. With more work the library can be migrated to Jakarta classes. For now, keep the functionality the same as the Java 8 classes. Changes resulted in duplicatejavax.xml.nmespaceclasses. The POIstax-api-1.0.1.jarfile seems to be not needed with changes so remove from he dependency list.rti.tscommandprocessor.commands.waterml2WaterML2ReaderThe ElementNSImplclass is not available in Java 11. It was part of thexercsesDOM parsor. Use the built-inElementclass instead.gov.usda.nrcs.wcc.ns.awdbwebserviceAwdbWebServicejavax.jwspackages not found in Java 11. The solution is to usejavax.jws-apiMaven package to keep the legacy classes. Updating to the Jakarta equivalent can occur later.gov.usda.nrcs.wcc.ns.awdbwebserviceAwdbWebServicejavax.xml.wspackages not found in Java 11. The solution is to usejavaws.apiMaven package to keep the legacy classes. Updating to the Jakarta equivalent can occur later.gov.usda.nrcs.wcc.ns.awdbwebserviceAwdbWebServicecom.sun.xml.internal.ws.client.BindingProviderPropertiespackage is not found in Java 11.Runtime error for NRCS AWDB web services. AwdbWebServicecom.sun.istack.localization.Localizablenot found. Need to include thejaxb-implMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServicecom.sun.xml.stream.buffer.AbstractCreatorProcessornot found. Need to include thestreambufferMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServicecom.sun.xml.ws.policy.PolicyExceptionnot found. Need to include thepolicyMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServiceorg.jvnet.staxex.XMLStreamReaderExnot found. Need to include thestate-exMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServicejavax.xml.soap.SOAPExceptionnot found. Need to include thejavax.xml.soap-apiMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServicecom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImplnot found. Need to include thesaaj-implMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServicejavax.activation.DataSourcenot found. Need to include thejavax.activationMaven artifact by downloading the jar.Runtime error for NRCS AWDB web services. AwdbWebServiceorg.glassfish.gmbal.ManagedObjectManagernot found. Need to include thegmbal-apiMaven artifact by downloading the jar.RTi.GIS.GeoViewGeoViewLegendJTreeFix unallowed type handling of TreeNode.RTi.GIS.GeoViewGeoViewLegendJTree_NodeFix unallowed type handling of TreeNode.RTi.GIS.GUISimpleJTree_WindowsGUIThe com.sun.java.swing.plaf.windows.WindowsTreeUIclass is not available. Switch tojavax.swing.plaf.basic.BasicTreeUI.RTi.GIS.GUISimpleJTreeThe com.sun.java.swing.plaf.windows.WindowsTreeUIclass is not available. Switch tojavax.swing.plaf.basic.BasicTreeUI.Many. Many Constructing primitives with newis now depreciated and, for exampleInteger.valueOf()should be used instead.RTi.GRTSTSGraphComponentMouseEvent.getModifiers()is deprecated. UsegetModifiersExand new InputEvent bitmask values instead.Many Most classses The finalize()method was deprecated in Java 9. Remove all the methods.As of Java 9, the class loading changed to use the Java Platform Module System (JPMS), also known as Project Jigsaw. One impact is that the same path cannot exist in multiple jar files. In the case below, the Apache
xmlbeans-2.3.0.jarfile contains mostly Apache-specific classes, but also contains the following:org/w3c/
org/w3c/dom/
org/w3c/dom/DOMConfiguration.class
org/w3c/dom/DOMStringList.class
org/w3c/dom/TypeInfo.class
org/w3c/dom/UserDataHandler.classBecause they are duplicates of classes included in Java, the following error is shown:
Using Ctrl-Shift-t in Eclipse allows searching for the
org.w3c.dompackage, as shown in the following figure.org.w3c.domConflict Error (see full-size image)
Eclipse Ctrl-Shift-t output for
org.w3c.domconflicts (see full-size image)To fix, create a script
cdss-lib-processor-ts-java/lib/apache-poi/fix-xmlbeans.bashthat removes the above classes and creates a new jar filexmlbeans-2.3.0-fixed.jar. Remove the old file from the libraries dependencies and add the new file. This clears up the errors.This basic procedure is repeated for all duplicate classes mentioned in the table above. In the future, moving to REST web services that use a library such as Jackson to parse the response will eliminate the need for SOAP and XML parsing packages, which seem to cause the most issues. Dependency management will be an issue as more plugins are added. Code for TSTool and plugins may need to be periodically (re)synchronized and in some cases Jar file contents may need to be manipulated to remove unnecessary classes.
-
-
Build system:
- Update the
conf/product.propertiesfiles to use Java 11 instead of 8. - Add libraries identified above, which were also added to the build path in Eclipse. Also remove and change library names as indicated.
- Update the
cdss-util-buildtoolsproject for Java 11. Add support for simple integer main version like11and phase out more complex1.8notation.common.xmlcommon-installer.xmlconf/product.properties- default properties
- Update the
- Update the
cdss-app-tstool-main/installer/CDSS/TSTool.nsito use lowercasedist\install-cdssfolder. - Update the
cdss-app-tstool-main/externals/CDSS/installer/CDSS/cdss.nshto use lowercasedist\install-cdssfolder (just a comment). - Update the
cdss-util-buildutils/externals/NSIS_Common/JRE.nsh:- As of Java 9, the
rt.jarfile is not used and instead Jigsaw modules are used. Disable the old code.
- As of Java 9, the
- Update
launch4j:- Successfully created an NSIS installer with the above changes, but TSTool had an error launching.
- Use
launch4jversion 3.50 and save in thecdss-util-buildtools/lib/launch4jfolder. - Save the old version to the
launch4j-javafolder. - This did not end up being the issue but keep the newer version.