Swing/AWT apps don't work inside a sandbox

Marco Dinacci marco.dinacci at gmail.com
Thu May 17 03:27:58 PDT 2012


Hi,

because freetype is still not included for osx, any Java app that
makes use of AWT/Swing won't work inside a sandbox as sandboxd will
refuse loading the freetype system library:

I made a simple app with only this line: Toolkit tk =
Toolkit.getDefaultToolkit();
and this is the result when I launch it from within a sandbox:

17/05/2012 10:58:24.423 sandboxd: ([9839]) JavaAppLauncher(9839) deny
file-read-data /usr/X11/lib/libfreetype.6.dylib
17/05/2012 10:58:24.426 [0x0-0x11eb1ea].SwingTest: Exception in thread "main"
17/05/2012 10:58:24.426 [0x0-0x11eb1ea].SwingTest:
java.lang.UnsatisfiedLinkError:
/Users/marco/Documents/Projects/appbundlertest/dist/SwingTest.app/Contents/PlugIns/1.7.0_latest.jdk/Contents/Home/jre/lib/libfontmanager.dylib:
dlopen(/Users/marco/Documents/Projects/appbundlertest/dist/SwingTest.app/Contents/PlugIns/1.7.0_latest.jdk/Contents/Home/jre/lib/libfontmanager.dylib,
1): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
17/05/2012 10:58:24.426 [0x0-0x11eb1ea].SwingTest:   Referenced from:
/Users/marco/Documents/Projects/appbundlertest/dist/SwingTest.app/Contents/PlugIns/1.7.0_latest.jdk/Contents/Home/jre/lib/libfontmanager.dylib
17/05/2012 10:58:24.426 [0x0-0x11eb1ea].SwingTest:   Reason: no
suitable image found.  Did find:
17/05/2012 10:58:24.426 [0x0-0x11eb1ea].SwingTest:
	/usr/X11/lib/libfreetype.6.dylib: open() failed with errno=1
17/05/2012 10:58:24.427 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.ClassLoader$NativeLibrary.load(Native Method)
17/05/2012 10:58:24.427 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
17/05/2012 10:58:24.427 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.Runtime.loadLibrary0(Runtime.java:845)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.System.loadLibrary(System.java:1084)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
sun.lwawt.macosx.LWCToolkit$1.run(LWCToolkit.java:77)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.security.AccessController.doPrivileged(Native Method)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
sun.lwawt.macosx.LWCToolkit.<clinit>(LWCToolkit.java:74)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.Class.forName0(Native Method)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.lang.Class.forName(Class.java:186)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.awt.Toolkit$2.run(Toolkit.java:870)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.security.AccessController.doPrivileged(Native Method)
17/05/2012 10:58:24.428 [0x0-0x11eb1ea].SwingTest: 	at
java.awt.Toolkit.getDefaultToolkit(Toolkit.java:862)
17/05/2012 10:58:24.429 [0x0-0x11eb1ea].SwingTest: 	at
SwingTest.main(Unknown Source)

Note that in less than two weeks all applications submitted to the App
Store will have to be sandboxed.

Is anybody already working on bundling freetype ? I can provide this
simple project including the ant file which build and sign the app
(you will still need valid mac developer keys to sign the app though).
Otherwise I'll give it a try but I'll probably need some directions on
the best way to do it.

Best,
Marco


More information about the macosx-port-dev mailing list