Skip to content
Ben Stabler edited this page Sep 1, 2020 · 24 revisions

Building TLUMIP's Java Programs

TLUMIP makes use of Java, R, and Python software. The required Java, R, and Python distribution used by TLUMIP is included in the root/model/lib/ directory. All required third-party packages are included as well (i.e. have already been installed in the included distribution). The three dependent software bundles are zipped together in the root/model/lib/dependencies_64.zip to save space in the repository.

How To Build TLUMIP's Java programs

The core TLUMIP modules are written in Java and compiled into a series of jars:

  • tlumip.jar - source; built version
  • pasaat.jar (the PT model) - source; built version included within tlumip.jar
  • synpop.jar (the old SPG model) - source; built version included within tlumip.jar
  • common-base.jar - source; built version included within tlumip.jar
  • pecas.jar (the AA model) - source; built version

Build Instructions

The instructions for building common-base, synpop, pasaat, and tlumip are essentially the same. The only difference is that common-base needs to be built first since it is used by the others, synpop built second, pasaat built third, and tlumip built last.

  1. Build with Eclipse
  2. Download the code repository and import the project into Eclipse via File + Import
  3. As needed, update the project setup .classpath file references for required jar to those stored in the src folder
  4. Build with Ant
  5. Right click on build.xml and select Run As and then Ant Build. This should fail, but will setup a default Ant Build configuration
  6. Right click on build.xml and select Run As and then External tools configurations
  7. Go to the Targets tab and check "release"
  8. Click Run to build
  9. The output jar, such as tlumip.jar, will be in the release folder
  10. Copy tlumip.jar to the [tlumip code folder][tlumip\root\scenario\model\code] before running the model
  11. If changes to cmf are required, then modify and build common-base.jar and copy it to dependent project src folder(s)
  12. If changes to synpop are required, then modify and build synpop.jar and copy it to dependent project src folder(s)
  13. If changes to pasaat (PT) are required, then modify and build pasaat.jar and copy it to dependent project src folder(s)

The instructions for building pecas.jar (and the dependent oregonPP.jar) are:

  1. Download the source and import all the projects into Eclipse via File + Import
  2. Export a pecas and swim2 (aka oregonPP) JAR (File -> Export -> JAR file, then uncheck everything except src/java)
  3. Copy output jars to the AA code folder before running the model

Java Version

SWIM uses Java Runtime Environment 7 release 4 build 22. Make sure to compile the source code with Java 7. This version of Java has been deprecated by Oracle; you will need to join the Oracle developers program to download the JDK.

There are a number of ways to configure which version of Java you are using:

  • One way is to set your JAVA_HOME environment variable to the appropriate JDK, i.e. C:\Program Files\Java\jdk1.7.0_04
  • An alternative is to set the installed JRE in Eclipse via Window + Preferences + Java + Installed JREs and then set Java 7 as the default.
  • You may also need to set the version of Java to use for Ant within Eclipse, via Right click on build.xml and select Run As and then External tools configurations then JRE tab + Separate JRE.
  • Another possible Windows location for specifying which version of Java you are using is the C:\ProgramData\Oracle\Java\javapath entry in your system PATH.

If you run into java.lang.UnsupportedClassVersionError: com/pb/tlumip/ao/ModelEntry : Unsupported major.minor version 52.0 then you have compiled your jar with Java 8 and you are trying to run it with the Java 7 distribution included with TLUMIP.

Clone this wiki locally