Paul Kiddie

Using an older JDK within Eclipse and ant builds (Windows)

July 10, 2008

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:

  1. Add a new ant builder for the project, referring to your build.xml file
  2. Set the relevant targets, e.g. clean, build, auto-build
  3. 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).
  4. Let it run its course, press OK, and then select your JRE of choice.
  5. Build, and viola!

Also, any run/debug configurations will also default to this JRE.

👋 I'm Paul Kiddie, a software engineer working in London. I'm currently working as a Principal Engineer at trainline.