Ok, the resources that you need to read are:
- First, you need to read an awesome background article at Borderland Consulting
- Then, you'll want the very cool Jar Bundler Ant Task which will put together an app bundle for you and copy all your jars into the right directory structure and create an Info.plist file for you
- Then (and this bit just killed me), you must make sure that you chmod your .jnilib files executable! If you don't, you'll end up getting a "Could not load library" error even though the swt library is clearly in your java.library.path!
- Finally, you must add an entry StartOnMainThread
to your Info.plist file which resolved some Threading issues with the launcher. If you're getting weird GUI behaviour with disappearing buttons and bizarre crashes, it will probably be cause you've missed this setting.
no swt-carbon-3346 or swt-carbon in swt.library.path, java.library.path or the jar file 大意即,如果SWT應用程式用到了SWT組件,則還必須將SWT的本地化檔案加入到JVM可以找到的路徑中。方法有三個:
1.修改每個工程運行時的運行VM參數,用-Djava.library.path={runtime-library-path}把本地化SWT庫檔案通知JVM。顯然,這是指在Eclipse平台下運行,而且每個工程都要修改一次,很麻煩。
2.在環境變數中設定庫路徑。對於Linux,就是修改LD_LIBRARY_PATH這個環境變數,讓它指到本地化SWT庫中。
3.拷貝本地化SWT庫檔案到已經指定的Java庫路徑中。