如何解决 swt.library.path、java.library.path 或 jar 文件中没有 swt-cocoa-3557 或 swt-cocoa 错误?

发布于 2024-09-03 08:53:10 字数 1507 浏览 3 评论 0原文

我无法让 swt 应用程序在 Mac OSX Snow Leopard 上运行。

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-cocoa-3557 or swt-cocoa in swt.library.path, java.library.path or the jar file
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
    at org.eclipse.swt.internal.cocoa.NSThread.isMainThread(Unknown Source)
    at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at com.astrobetty.geotag.Hello.main(Hello.java:12)

我已将 -Dswt.library.path= 和 -Djava.library.path 语句添加到“VM 参数”中,还尝试将它们设置为 Eclipse 运行配置页面的“环境”部分中的变量。

我已验证我的 .jar 文件位于我指定的路径中。如果我查看 .jar 内部,它似乎包含这些库:

     102 Feb 12 13:21 META-INF
     183 Feb 12 13:21 external.xpt
   37104 Nov 17  2009 libswt-awt-cocoa-3557.jnilib
  287228 Nov 17  2009 libswt-cocoa-3557.jnilib
  548252 Nov 17  2009 libswt-pi-cocoa-3557.jnilib
  313420 Nov 17  2009 libswt-xulrunner-cocoa-3557.jnilib
    136 May 23 22:19 org
     13 Feb 12 13:21 version.txt

关于如何让它工作的任何想法?有可能吗?

我将 swt 添加为“依赖项目”,详细信息如下

http://www.eclipse.org/ swt/eclipse.php

并且它似乎在编辑时找到了 .jar 文件(我对 swt 类和方法进行语法检查等。)

I can't get a swt application to work on Mac OSX Snow Leopard.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-cocoa-3557 or swt-cocoa in swt.library.path, java.library.path or the jar file
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
    at org.eclipse.swt.internal.cocoa.NSThread.isMainThread(Unknown Source)
    at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at com.astrobetty.geotag.Hello.main(Hello.java:12)

I have added -Dswt.library.path= and -Djava.library.path statements to the "VM arrguments" hand have also tried setting them as variables in the "environment" section of the Eclipse run configuration page.

I've verified that my .jar file is at the path I specify. If I look inside the .jar, it seems to contain these libraries:

     102 Feb 12 13:21 META-INF
     183 Feb 12 13:21 external.xpt
   37104 Nov 17  2009 libswt-awt-cocoa-3557.jnilib
  287228 Nov 17  2009 libswt-cocoa-3557.jnilib
  548252 Nov 17  2009 libswt-pi-cocoa-3557.jnilib
  313420 Nov 17  2009 libswt-xulrunner-cocoa-3557.jnilib
    136 May 23 22:19 org
     13 Feb 12 13:21 version.txt

Any ideas on how to get this to work? Is it possible at all?

I added swt as a "dependent project" as detailed here

http://www.eclipse.org/swt/eclipse.php

and it does seem to find the .jar files at edit time (I get syntax checking, etc, for the swt classes and methods.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玩物 2024-09-10 08:53:10

我在android中遇到了同样的问题,就我而言,我已经解决了这样的问题:

下载“swt-3.7.1-cocoa-macosx-x86_64.zip”

http://archive.eclipse.org/eclipse/downloads/drops/R-3.7.1-201109091335/

并将“swt.jar”放入“android-sdk-macosx/tools/lib/x86_64”目录中。
您可以安全地覆盖现有的 swt.jar。

I had the same issue in android, in my case, I've solved like this:

Download "swt-3.7.1-cocoa-macosx-x86_64.zip" from

http://archive.eclipse.org/eclipse/downloads/drops/R-3.7.1-201109091335/

and put the "swt.jar" into the "android-sdk-macosx/tools/lib/x86_64" directory.
You can safely overwrite the existing swt.jar.

兔小萌 2024-09-10 08:53:10

添加“依赖项目”可以在 IDE 中使用,但不能用于部署。您可能在 OSGi 环境中...我不确定您如何部署该产品,但是如果您创建一个 .product 文件(新建 -> 产品配置),请包含您的插件和 SWT 插件以及然后使用该产品导出,我相信它会为您解决问题。

Adding a 'dependent project' works in the IDE, but not for deployment. You're probably in the OSGi environment... I'm not sure how you're deploying the product, but if you create a .product file (New-->Product Configuration), include your plugins and the SWT plugins and then export using that product and I'm sure it'll work out for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文