Matt
Matt

Reputation: 8942

Install JDK 1.5 in OSX 10.10 Yosemite

I use OS X Yosemite (10.10.2) and I have to use JDK 1.5 for legacy application development. I found this post which refers to this script to install JDK 4,5,6 in Lion and Mavericks. In comments I found this two lines

/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist
/usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist

have to be changed by

/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumFrameworkVersion" ./Resources/Info.plist
/usr/libexec/PlistBuddy -c "Delete :JavaVM:JVMMaximumSystemVersion" ./Resources/Info.plist

to achieve compatibility with Yosemite. I ran this script and this is content of my /System/Library/Frameworks/JavaVM.framework/Versions directory

lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10  9 apr 11:01 1.5 -> ./1.5.0_30
lrwxr-xr-x  1 root  wheel   10  9 apr 11:01 1.5.0 -> ./1.5.0_30
drwxr-xr-x  9 root  wheel  306  9 apr 11:01 1.5.0_30
lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10  8 apr 14:36 1.6.0 -> CurrentJDK
drwxr-xr-x  7 root  wheel  238  8 apr 14:36 A
lrwxr-xr-x  1 root  wheel    1  8 apr 14:36 Current -> A

In Eclipse preferences Java->Installed JREs->Execution Environments, there is not any JRE 1.5

enter image description here

and probably this is the reason why I cannot build projects in Java 5, because I get errors:

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.

In Eclipse preferences Installed JREs - JSE-1.5 refers to correct path

enter image description here

In project preferences Java Build Path contains J2SE-1.5

enter image description here

and Java Compiler in project preferences is set correctly as well.

enter image description here

This is content of /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30 directory

enter image description here

This thread refers to my previous post.

Upvotes: 2

Views: 3070

Answers (1)

Rossiar
Rossiar

Reputation: 2564

I think the solution to your problem might be in this question.

Eclipse is a powerful IDE, and as such can tell a 1.6/1.7/1.8 JRE to run as if it was a 1.5 JRE. I am not familiar with using this, but it looks a lot easier than downloading an entirely different JDK.

To change the compiler compliance level, go to your Project Settings -> Java Compiler

Java Compiler Settings

Untick Use compliance from execution environment and ensure that Use default compliance settings is ticked, and that the box alongside that is set to 1.5.

Then you can change back to using your JDK 1.7.

Please let me know if this worked, as I can post an answer that walks through installing a new JRE for you, if this hasn't helped.

Upvotes: 1

Related Questions