|Title: How do I compile for compatibility with older versions of Java?|
When I run my program with an older version of the Java runtime environment I get the following error:
What can I do to resolve this?
How can I see the version number in the .class file?
You can use the -jo compiler command line option in order to specify options to be passed to the Java compiler such as:
"-source" and "-target".
For example, to compile for compatibility with Java 1.4.2 add the following to your compile command line
To compile a program named MYPROG.cbl:
(you can omit "-target 1.4" since it is the default when specifying "-source 1.4")
Here is the documentation for the -source and -target options from Java
The default for -target depends on the value of -source:
In order to check the version number in a .class file you can use the javap utility that is distributed with the JDK. For example, the following command will report the version of a program named MYPROG.
or run "javap -verbose MYPROG" and the version numbers will be reported in the first 5 lines.
Note that MYPROG.class must be in the class path. You can specify a class path with javap -cp.
The major version number will be 48 for Java 1.4.2, 49 for Java 5, 50 for Java 6, and 51 for Java 7.
|Authored by: Veryant Support on Mon, Aug 31st, 2009 at 7:00 PM
This question has been viewed 64563 times so far.
|Online URL: http://support.veryant.com/support/phpkb/question.php?ID=57|
Powered by PHPKB Knowledge Base Software