Ok. In that case it is best to compile to the oldest JVM you want to
support using javac cross-compilation. This way you would have gotten
a compile time error instead of runtime exception.
CROSS-COMPILATION OPTIONS
By default, classes are compiled against the bootstrap and
extension
classes of the JDK that javac shipped with. But javac
also supports
cross-compiling, where classes are compiled against a
bootstrap and
extension classes of a different Java platform
implementation. It is
important to use -bootclasspath and -extdirs when cross-
compiling; see
Cross-Compilation Example below.
-bootclasspath bootclasspath
Cross-compiles against the specified set of boot
classes. As
with the user class path, boot class path entries are
separated
by colons (:) and can be directories, JAR archives,
or ZIP ar-
chives.
-extdirs directories
Cross-compiles against the specified extension
directories.
Directories are a colon-separated list of
directories. Each JAR
archive in the specified directories is searched
for class
files.
-target version
Generates class files that will work on VMs with the
specified
version. The default is to generate class files to
be compati-
ble with the 1.2 VM, with one exception. When the -
source 1.4
option is used, the default target is 1.4. The
versions sup-
ported are:
1.1 Ensures that generated class files will be
compatible
with 1.1 and 1.2 VMs.
1.2 Generates class files that will run on 1.2
VMs, but will
not run on 1.1 VMs. This is the default.
1.3 Generates class files that run on 1.3 and later
VMs, but
will not run on 1.1 or 1.2 VMs.
1.4 Generate class files that are compatible
only with 1.4
VMs.
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden