简体   繁体   English

无法加载Java库

[英]Can't load Java Library

I am very new to Java and I am trying to run a program I got from a friend. 我对Java非常陌生,我正在尝试运行从朋友那里获得的程序。 I keep getting this error and I'm unsure how to solve the problem. 我一直收到此错误,并且不确定如何解决该问题。

Application is starting. 应用程序正在启动。 Fetching data. 正在获取数据。 Please wait... (approx. 10s) Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. 请稍候...(约10秒)线程“主”中的异常java.lang.UnsatisfiedLinkError:无法加载SWT库。 Reasons: no swt-cocoa-4236 in java.library.path no swt-cocoa in java.library.path Can't load library: C:\\Users\\Andrew.swt\\lib\\win32\\x86_64\\swt-cocoa-4236.dll Can't load library: C:\\Users\\Andrew.swt\\lib\\win32\\x86_64\\swt-cocoa.dll 原因:java.library.path中没有swt-cocoa-4236 java.library.path中没有swt-cocoa无法加载库:C:\\ Users \\ Andrew.swt \\ lib \\ win32 \\ x86_64 \\ swt-cocoa-4236 .dll无法加载库:C:\\ Users \\ Andrew.swt \\ lib \\ win32 \\ x86_64 \\ swt-cocoa.dll

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
    at org.eclipse.swt.interal.C.<clinit>(C.java:21)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:101)
    at view.MainWindow.open(MainWindow.java:77)
    at view.MainWindow.main(MainWindow.java:65)

Apparently I'm missing the SWT library (swt-cocoa-4236 and/or swt-cocoa?), but I have no idea where to get it. 显然我缺少SWT库(swt-cocoa-4236和/或swt-cocoa?),但是我不知道从何处获得它。 That statement probably reveals my ignorance. 那句话可能显示出我的无知。 If anyone could even point me in the right direction to where I might be able to solve the problem I'd be very grateful. 如果有人能将我朝正确的方向指出可能解决问题的方向,我将不胜感激。 Thanks! 谢谢!

Seems like the program that you are running is not built for your OS. 似乎您正在运行的程序不是为您的操作系统构建的。 SWT is OS dependant and JVM depedant. SWT依赖于操作系统且依赖JVM。 All SWT programs will use swt.jar which will be different based on the underlying OS. 所有SWT程序都将使用swt.jar ,该文件会根据基础操作系统而有所不同。 The one the program is using is built for Mac OS and seems like you are running that on a non-Mac system. 该程序正在使用的程序是为Mac OS构建的,似乎您是在非Mac系统上运行的程序。

Regarding 'How to solve it', it depends on how the program that you are running is packaged. 关于“如何解决”,取决于您正在运行的程序的打包方式。

Check the java version you are using and download appropriate SWT jar file. 检查您使用的Java版本并下载适当的SWT jar文件。

I think Mubin (ie the above answer) is correct. 我认为Mubin(即上述答案)是正确的。 here is where you can download the specific version of SWT.jar for your environment http://www.eclipse.org/swt/ . 在这里,您可以http://www.eclipse.org/swt/下载适用于您环境的SWT.jar的特定版本。

(I am answering your question for "I have no idea where to get it.") (我正在回答您的问题“我不知道从哪里得到它。”)

little late to the game, but i just had the same problem and found this solution : 比赛还没来得及,但是我遇到了同样的问题,发现了以下解决方案

Here's what worked for me: 这对我有用:

Right Click on your Project Folder of your HelloWorldSWT Project-> Properties -> Java Build Path -> Tab 'Projects' 右键单击HelloWorldSWT项目的项目文件夹->属性-> Java构建路径->选项卡“项目”

Expand the 'org.eclipse.swt.cocoa.macosx.x86_64' folder by clicking on the arrow left to it 通过单击左侧的箭头,展开“ org.eclipse.swt.cocoa.macosx.x86_64”文件夹

Select 'Native library location' and click Edit 选择“本地库位置”,然后单击“编辑”

Click the Workspace Button and select 'org.eclipse.swt.cocoa.macosx.x86_64', then click ok (serveral times). 单击工作区按钮,然后选择“ org.eclipse.swt.cocoa.macosx.x86_64”,然后单击确定(服务器时间)。

That did the trick ... Ma-an 那成功了...马安

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java加载库“找不到依赖库” - Java load library 'Can't find dependent libraries' VSCode无法加载项目Java库-如何修复? - VSCode can't load project Java library - how to fix? UnsatisfiedLinkError无法加载库 - UnsatisfiedLinkError Can't Load Library 无法加载Skuli库 - Can't load Skuli library 加载dll库文件时出现问题... java.lang.UnsatisfiedLinkError:无法加载库 - Issue while loading a dll library file… java.lang.UnsatisfiedLinkError: Can't load library Java应用程序能够加载库,但找不到函数(可视c ++名称修改?) - Java app able to load library but can't find function (visual c++ name mangling?) 线程“main”中的异常 java.lang.UnsatisfiedLinkError - 无法加载库 - 无法获取 InputStream - Exception in thread “main” java.lang.UnsatisfiedLinkError - Unable to load library - Can't obtain InputStream 无法解决错误([-93]无法加载库:java.lang.UnsatisfiedLinkError :) - Can't resolve error ([-93] cannot load library: java.lang.UnsatisfiedLinkError:) 为什么Java应用程序无法从其自己的.jar加载库二进制文件? - Why can't a Java application load library binaries from its own .jar? Java.lang.UnsatisfiedLinkError: Can't load library when loading mp3 file - Java.lang.UnsatisfiedLinkError: Can't load library when loading mp3 file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM