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

    by  • July 10, 2008 • java • 1 Comment

    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.

    About

    .NET developer at thetrainline.com, previously web developer at MRM Meteorite. Awarded a PhD in misbehaviour detection in wireless ad-hoc networks.A keen C# ASP.net developer bridging the gap with APIs and JavaScript frameworks, one web app at a time.

    http://www.paulkiddie.com

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

    1. Pingback: Bookmarks about Builds

    Leave a Reply

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