Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling Java 6 code to 1.3-compliant bytecode?

 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf, this worked perfectly!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic