tags:

views:

383

answers:

1

I'm trying to use the following import in Eclipse running on Mac OS X 10.6:

import javax.media.jai.JAI;

Unfortunately, this doesn't work, instead I get the following message:

"Access restriction: The type JAI is not accessible due to restriction on required library /System/Library/Java/Extensions/jai_core.jar"

How can this be resolved? I want to use JAI.create("fileload", "filename");

The file permissions in the folder Extensions:

$ ls -l
total 20536
-rwxrwxr-x  1 root  wheel     6470  6 Jan 19:20 AppleScriptEngine.jar
-rwxrwxr-x  1 root  wheel    12838 23 Apr 18:16 MRJToolkit.jar
-rwxrwxr-x  1 root  wheel   938700  3 Mar 01:41 QTJava.zip
-rwxrwxr-x  1 root  wheel    17786 11 Feb 13:49 dns_sd.jar
-rwxrwxr-x  1 root  wheel  1223487 21 Jul  2009 j3daudio.jar
-rwxrwxr-x  1 root  wheel  1157342 21 Jul  2009 j3dcore.jar
-rwxrwxr-x  1 root  wheel   685292 21 Jul  2009 j3dutils.jar
-rwxrwxr-x  1 root  wheel   275486 18 May  2009 jai_codec.jar
-rwxrwxr-x  1 root  wheel  1544537 18 May  2009 jai_core.jar
-rwxrwxr-x  1 root  wheel   106688  6 Jan 19:20 libAppleScriptEngine.jnilib
-rwxrwxr-x  1 root  wheel   427632 21 Jul  2009 libJ3D.jnilib
-rwxrwxr-x  1 root  wheel   733280 21 Jul  2009 libJ3DAudio.jnilib
-rwxrwxr-x  1 root  wheel    50880 21 Jul  2009 libJ3DUtils.jnilib
-rwxrwxr-x  1 root  wheel  1004544  3 Mar 01:44 libQTJNative.jnilib
-rwxrwxr-x  1 root  wheel    50352 23 Dec 10:25 libShark.jnilib
-rwxrwxr-x  1 root  wheel  9959424 18 May  2009 libmlib_jai.jnilib
-rwxrwxr-x  1 root  wheel    41239 18 May  2009 mlibwrapper_jai.jar
-rwxrwxr-x  1 root  wheel   127628 21 Jul  2009 vecmath.jar

A quick fix can be found here: http://lkamal.blogspot.com/2008/09/eclipse-access-restriction-on-library.html (However, it's more of a work-around...)

A: 

You might check file's the permissions. Here's what 10.5 looks like:

$ ls -l /System/Library/Java/Extensions/jai_core.jar
-rw-r--r--  1 root  wheel  1893836 May 31  2008 /System/Library/Java/Extensions/jai_core.jar
trashgod
Thanks, I've tried to change the file permissions but it doesn't seem to help. I have found that I can compile the program from the command line, so the problem seems to be Eclipse-related.
Ed Taylor
In `Eclipse > Preferences > Java > Installed JREs`, I added 1.6 as a new VM, and `jai_core.jar` appeared in automatically as a library in `/System/Library/Java/Extensions`.
trashgod
I have Java 1.6 as my VM, the library is there, it can even be browsed from Eclipse. However, Eclipse still claims that there is an "Access restriction" and refuses to approve of the import.
Ed Taylor
I found a quick fix here:http://lkamal.blogspot.com/2008/09/eclipse-access-restriction-on-library.html
Ed Taylor
For better visibility, you should post this as an answer or as an addendum to your question.
trashgod