I need to install JDK 5 for testing Amazon mechanical turk APIs (which is not fully com开发者_Python百科patible with JDK 6). On Apple's website, I can only find the latest JDK. Is there a way to get older versions of JDKs for Mac?
This hint might help : 10.6: Re-enable Java 1.4.2 and Java 1.5 apps in Snow Leopard
Yes, this is the problem with macs.
If you do backups, then you can just copy old folders containing jdk 5 from backup disk back to your machine. Worked for me.
use
-target 1.5
You can compile against the 1.5 jdk with settings in javac.
In your case :
javac -source 1.5 -target 1.5
You can even set this in your IDE. Or you can do this with maven and the maven.compile.target
and maven.compile.properties
-source release
Specifies the version of source code accepted. The following values for release are allowed:
[...]
- 1.5
The compiler accepts code containing generics and other language features introduced in JDK 5.[...]
-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1 1.2 1.3 1.4 1.5 (also 5) and 1.6 (also 6).
The default for -target depends on the value of -source:
- If -source is not specified, the value of -target is 1.6
- If -source is 1.2, the value of -target is 1.4
- If -source is 1.3, the value of -target is 1.4
For all other values of -source, the value of -target is the value of -source.
Resources :
- Javac 6 documentation
- Maven - Setting the -source and -target of the Java Compiler
精彩评论