Re: single jar containing both Java 5 and 6 jars
In the case of an entirely new class, you
can make a *single class* that caters for
both Java 1.5 and Java 1.6.
It works something like this..
In the code,
try {
Java6Class newThing = new Java6Class();
} catch(NoClassDefFoundError ncdfe) {
// proceed without it..
}
The hard part is compiling that code so it is
guaranteed to be 1.5 compatible. To do that
you might try..
REM: all one line, broken for clarity
javac
-target 1.5
-bootclasspath path/to/1.5/rt.jar
*.java
...but that, of course, will show a compilation
error on Java6Class. To fix that, ..
javac
-target 1.5
-bootclasspath path/to/1.5/rt.jar
-classpath path/to/1.6/rt.jar
*.java
1st javac will check the 1.5 rt.jar, if it
does not find the class, it will check the
1.6 rt.jar.
As far as I can figure, the only time you
need to factor out later functionality into
a separate class, is when using methods or
attributes of a class that already existed in
the ealrier version. In that event, the 1.5
class will be loaded, and the 1.6 member will
not be available.
At least, that is my latest best theory. I
had not gotten around to testing it. If you
should try, please report back the results.
--
Andrew Thompson
http://pscode.org/