tags:

views:

952

answers:

3

I've got to write some code for a legacy application that is still running JDK 1.5. Unfortunately, it looks like OSX doesn't actually have a 1.5 JDK installed, it just links to 1.6:

/System/Library/Frameworks/JavaVM.framework/Versions $ ls -l
lrwxr-xr-x  1 root  wheel    5 Apr 26 11:53 1.3 -> 1.3.1
drwxr-xr-x  3 root  wheel  102 Feb 11 15:33 1.3.1
lrwxr-xr-x  1 root  wheel   10 Apr 26 11:53 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Apr 26 11:53 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Apr 26 11:53 1.5 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Apr 26 11:53 1.5.0 -> CurrentJDK
lrwxr-xr-x  1 root  wheel    5 Apr 26 11:53 1.6 -> 1.6.0
drwxr-xr-x  7 root  wheel  238 Apr 26 11:53 1.6.0
drwxr-xr-x  8 root  wheel  272 Apr 26 11:53 A
lrwxr-xr-x  1 root  wheel    1 Apr 26 11:53 Current -> A
lrwxr-xr-x  1 root  wheel    3 Apr 26 11:53 CurrentJDK -> 1.6

It sounds like from http://developer.apple.com/java/faq/ that Java is part of the OS update...I'm on OSX-10.6.3. Anybody know of a way to get an actual 1.5 JDK installed on this OS version? Or do I need to try and find an old version of OSX before I can do this work?

A: 

You need a older version of OS X for that.

J-16 SDiZ
+4  A: 

You don't need a copy of Java 1.5 in order to develop for it; Java 1.6 is backwards-compatible with Java 1.5, so anything that would work on 1.5 will work on 1.6. The -source and -target flags may be of use in order to ensure that everything works on 1.5. That said, this article will explain how to get a copy of Java 1.5 on Snow Leopard. Be aware, though, that it could potentially trash/harm your system.

Michael Aaron Safyan
+1  A: 

If you're writing code in Eclipse or potentially some other IDE, you should be able to configure it to target 1.5 compliance.

If you are using javac directly, you could try the -source 1.5 and/or -target 1.5 javac options, which may be sufficient for what you're doing? The 1.6 JDK should be able to produce 1.5-compliant code.

Steven Schlansker