I’m working on a university project which is based in cloudsim3.0 project. I’m using jdk 7 while the cloudsim uses jdk 1.3. So I have to change everything: generics, for-each loops , etcetera. Some of the errors I received from NetBeans are:
- Generics are not supported in -source1.3 (use -source7 or higher …)
- Strings in switches are not supported in -source1.3 (use -source7 or higher …)
…
How can I change the jdk version from 1.3 to 7?
Thanks
Generally you want to be very careful with developing in a higher Java version than you deploy to. The java compiler in the JDK which is what Netbeans uses do not support compiling Java 7 source to 1.3 bytecode, so you need to use another compiler which do.
I spent some time a while back investigating this for targetting Java 1.4, and you can use the Eclipse compiler either directly inside Eclipse or as ecj (which is a javac drop in replacement from the command line) which can be used inside ant, or you can use Retroweaver which actively converts byte code to an earlier version.
You might consider just biting the bullet and use Java 1.3 for your project, as it removes all these magic bullets from what you need to investigate if your code for any reason does not work.