Fresh install of Eclipse on 10.9.2 cannot access com.apple.eawt package contents

configurationeclipsejava

I just got a Mac so I am a total newbie (I picked one up because I was unable to successfully do Mac development on my Windows Machine). The machine I have is at OS 10.9.2 and I installed Eclipse fine. But when I try to use the Java extensions it says I cannot access the package in the JDK.

This is related to a programming question I have over on stack overflow:

https://stackoverflow.com/questions/23810403/how-do-i-make-use-of-the-apple-extensions-for-java-using-eclipse/23814735?noredirect=1#comment36639985_23814735

But what I need to know now is how to get the Mac / Java / Eclipse to cooperate. I have answers for the programming side of it but the answerer is using 10.8 and I am using 10.9 and it looks like we have things setup the same – from what we have compared.

What am I missing? Is there some other configuration change that needs to be made? Will this work with 10.9 and Java 1.6? Like I said I am a total newbie and I know that Apple has made changes regarding their support of Java I just don't know if that is a factor here or not.

Best Answer

This turns out to be an Eclipse configuration issue not an Mac configuration issue.

Under the build path the jvm has access rules that forbid the use of the com.apple package and sub packages. I added an access rule "com/apple/eawt/**" and now Eclipse is happy to compile the code.

Open the project properties and select the access rules for the JRE used for the Java Build Path Project build preferences

Then add an access rule to allow access to the com.apple.eawt package. Add an access rule