Yucca Nel wrote:I never understood this completely. If i code an application using JDK 6+ and I use a eclusive to JDK 6+ class then would a user be able to run it with JRE5? IOW is the JDK version tied to the JRE? If the answer is no then would a proper exception(runtime) for a nimbus LookAndFeel be to advise the user to check their JRE version or try upgrade it?
No he will not be able to run the code, because, yes, they are connected. Generally, the version you use to run a code should be at least equal to the version you compiled with (if you don't use any specific target when compiling). Otherwise you'll get an unsupported class version exception (checked through the major.minor versions of your compiled class(es)...).
If user's environment allows an upgrade, that should be the way. You can have more than one JRE versions install, so you could install the newest version and use it with you app and leave the rest of the user's system as it is...
If you compile a class with JDK version N, then you need JRE version N or newer to run it. So, a class file compiled with JDK 6 will normally not run on JRE 5 or older - but a class file compiled with JDK 5 will run on JRE 6.
When you compile your class, you can specify a command line switch to produce a class file that it compatible with a certain JRE version, for example:
javac -target 5 MyProgram.java
This will create a class file that is compatible with JRE 5. However, this does not mean that it will run on JRE 5 - if you have used classes from the standard API that are new in Java 6, it will still not run on JRE 5. The "-target" switch only makes sure that the class file version is compatible with the JRE version that you specify.
See the javac tool documentation for details on the "-target" switch.
If you are required to make class files that run on JRE 5, then the safest option is to use JDK 5.