Sometimes its necessary to use an older JDK for compiling legacy Java applications. One of these is Jist/SWANS, a discrete event simulator which uses the Apache bytecode engineering library (bcel) but was written in the Java 1.4/1.5 era. The .class stucture has changed in the 1.6 version, and development of bcel hasn’t kept up. Heres how to do it for Ant builds:
- Add a new ant builder for the project, referring to your build.xml file
- Set the relevant targets, e.g. clean, build, auto-build
- Within JRE tab, select ‘Seperate JRE’ radio button and select the JRE of choice (must be a jdk_ for javac). If the one you’ve installed doesnt appear in the drop down list of JRE’s, then click on the Installed JRE button, click Search, and select the folder in which all your Java environments exist (C:Program FilesJava by default).
- Let it run its course, press OK, and then select your JRE of choice.
- Build, and viola!
Also, any run/debug configurations will also default to this JRE.