Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I need help setting the compiler compliance to as earlier a version as is reasonable.

 
Anna Flanneur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,


I need help setting the compiler compliance to as earlier a version as is reasonable. As is evident, when accessed over the internet, the applets load on all new computers but not on old ones. This means people with earlier versions of the VM are not able to load the applets.
I have looked at the documentation for javac (http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html) and read through the cross-compilation options section, but still I don't get what I need to do to fix the problem.
Will someone please show me an example of how they would set the compiler compliance for say HelloWorld.java so that the applet is viewable by earlier VMs?


Thanks.
 
A Shehadi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you have to do is use the options "-source" and "-target" to specify this.

For example, if you want to compile for Java 1.3, you would do



This means that the source files should be read as if programmed for Java 1.3 and should be compiled to be exectued by Java 1.3. Also, I'm not sure but I think source must always be lower than target, so you can do "-source 1.2 -target 1.5" but not the other way around.

Keep in mind that your code mut be 1.x compliant, meaning that it won't be possible to use features from say, Java 1.6 but compile for Java 1.4, so a lot of "errors" might come up from an already working application if compiled in a higher version.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic