Daniela Koller: Neues SDK kompatibel zu altem JRE?

Beitrag lesen

Hi Def

Du kannst beim Javacompiler mit der -target Option angeben, welche JRE-Version mit dem generierten Bype-Code klar kommen muss. Möglich sind 1.1, 1.2, 1.3 und 1.4, bei neueren Compilerversionen wahrscheinlich noch 1.5.

Ein Auszug aus der Manpage zu diesem Thema:

-target version
Generates class files that will work on VMs with  the specified version. The default is to generate class files to be compatible with 1.2 VMs, with  one exception.  When  the  -source  1.4 option  is  used, the default target is 1.4.

The versions supported 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 VMs in the Java 2  SDK, v1.3 and later, but will not run on 1.1 or 1.2 VMs.

1.4    Generates  class  files that are compatible only with 1.4 VMs.

Gruss Daniela