在Mac下运行swt出错:java.lang.UnsatisfiedLinkError: no swt-carbon-3346 or swt-carbon in swt.library.path, ...

本文详细介绍了使用SWT开发的应用程序如何进行正确的打包流程。包括阅读背景文章、使用JarBundler Ant任务创建应用包、确保.jnilib文件可执行及在Info.plist文件中添加StartOnMainThread条目等内容。

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库路径中。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值