I'm developing a library that contains some functionality that is only available in Java 6.0. I want anyone using the package to be able to deploy the jar file to older JDKs (1.3). I already have code that detects the JRE version and pops a warning if it's not 6.0, but I want to be able to compile to 1.3-compliant bytecode, so the developer can at least use the rest of the non-6.0 functionality. Is there a way to do this in an Ant <javac> task?
I would imagine I'm looking to compile using JDK6.0, but to 1.3-compliant bytecode. Is this possible?
posted 8 years ago
Yes, that's possible. Check out the "source" and "target" attributes of the javac task. They provide the same functionality as the -source and -target javac command line switches.