tags:

views:

80

answers:

4

I need to install JDK 5 for testing Amazon mechanical turk APIs (which is not fully compatible 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?

A: 

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 :

Colin Hebert
Sadly, it doesn't make your jdk or jre to run as version 5. Although it may solve some problems, all the libraries are still from the version 6.
Nikita Rybak
You're right but I'm afraid there is nothing you can do for this.
Colin Hebert
A: 

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.

Nikita Rybak
A: 

use

-target 1.5

Woot4Moo
+1  A: 

This hint might help : 10.6: Re-enable Java 1.4.2 and Java 1.5 apps in Snow Leopard

Damien