wood burning stoves 2.0*
The moose likes Java in General and the fly likes Compiling Java 6 code to 1.3-compliant bytecode? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Compiling Java 6 code to 1.3-compliant bytecode?" Watch "Compiling Java 6 code to 1.3-compliant bytecode?" New topic
Author

Compiling Java 6 code to 1.3-compliant bytecode?

Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
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?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41046
    
  43
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.


Ping & DNS - my free Android networking tools app
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
Thanks Ulf, this worked perfectly!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling Java 6 code to 1.3-compliant bytecode?
 
Similar Threads
I need help setting the compiler compliance to as earlier a version as is reasonable.
Java upgrade path
Want to change from jre 1.4 to 1.3 in IRAD 6.0
Compiler Error Version Problem
Help-virgin programmer. I don't know how to enter and compile a program