Problems importing JAI in Eclipse
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 2053开发者_Go百科6
-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...)
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
Fixed my issue with JAI by removing the JRE System Library from the build path and then re-adding it. This fix is based on the solution provided here.
精彩评论