E' possibile con il J2SDK 1.4.1 compilare solo con le classi del JDK 1.1?
Oppure è possibile installarli tutti e due e decidere dopo con cosa compilare?
E' possibile con il J2SDK 1.4.1 compilare solo con le classi del JDK 1.1?
Oppure è possibile installarli tutti e due e decidere dopo con cosa compilare?
Ho scoperto che c'è una opzione -target, ma non riesco ad usarla... Qualcuno l'ha mai vista?
estratto dalle tool/doc reference di java:
Cross-Compilation Options
By default, classes are compiled against the bootstrap and extension classes of the platform 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.
-target version
Generate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with the 1.2 VM in the Java 2 SDK. The versions supported by javac in the Java 2 SDK are:
1.1
Ensure that generated class files will be compatible with 1.1 and VMs in the Java 2 SDK.
1.2
Generate class files that will run on VMs in the Java 2 SDK, v 1.2 and later, but will not run on 1.1 VMs. This is the default.
1.3
Generate class files that will run on VMs in the Java 2 SDK, v 1.3 and later, but will not run on 1.1 or 1.2 VMs.
1.4
Generate class files that are compatible only with 1.4 VMs.
ciao.
Slack? Smack!
L'avevo trovato anch'io, ma non riesco a farlo funzionare... Mi viene il dubbio che con tutti questi problemi che ho riscontrato, forse devo cambiare JDK.
Naturalmente la tua applicazione deve utilizzare solamente classi e package relativi ad una ben precisa versione del kit di sviluppo.
Se vuoi compilare per jdk 1.1 per esempio usa:
> javac -target 1.1 <classe>
ciao.
Slack? Smack!