• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
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.
 
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.
 
Yes, my master! Here is the tiny ad you asked for:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic