Ubuntu 18:eclipse 尝试加载 SWT 库时失败

Ubuntu 18:eclipse 尝试加载 SWT 库时失败

我正在运行最新的 eclipse,当我打开 WindowBuilder JTable 模型的对话框时,出现此错误:

Blockquote org.eclipse.swt.SWTError: Unspecified error [Error while starting AWT] (java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: /media/Backup/eclipse/java-2021-09/eclipse/configuration/org.eclipse.osgi/333/0/.cp/libswt-awt-gtk-4946r21.so: /usr/lib/jvm/jdk-17/lib/libjawt.so: version SUNWprivate_1.1' not found (required by /media/Backup/eclipse/java-2021-09/eclipse/configuration/org.eclipse.osgi/333/0/.cp/libswt-awt-gtk-4946r21.so) no swt-awt-gtk in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib no swt-awt in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib /home/abusous2000/.swt/lib/linux/x86_64/libswt-awt-gtk-4946r21.so: /usr/lib/jvm/jdk-17/lib/libjawt.so: versionSUNWprivate_1.1' not found (required by /home/abusous2000/.swt/lib/linux/x86_64/libswt-awt-gtk-4946r21.so) Can't load library: /home/abusous2000/.swt/lib/linux/x86_64/libswt-awt-gtk.so Can't load库:/home/abusous2000/.swt/lib/linux/x86_64/libswt-awt.so /home/abusous2000/.swt/lib/linux/x86_64/libswt-awt-gtk-4946r21.so:/usr/lib/jvm/jdk-17/lib/libjawt.so:未找到版本“SUNWprivate_1.1”(/home/abusous2000/.swt/lib/linux/x86_64/libswt-awt-gtk-4946r21.so 所需))位于 org.eclipse.swt.SWT.error(SWT.java:4919)位于 org.eclipse.swt.awt.SWT_AWT.new_Frame(SWT_AWT.java:168)位于swingintegration.example.EmbeddedSwingComposite2.createFrame(EmbeddedSwingComposite2.java:338) at swingintegration.example.EmbeddedSwingComposite2.populate(EmbeddedSwingComposite2.java:196) at org.eclipse.wb.internal.swing.model.property.editor.models.table.TableModelDialog.createDialogArea(TableModelDialog.java:147) at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:767) at org.eclipse.jface.window.Window.create(Window.java:431) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1094) at org.eclipse.jface.window.Window.open(Window.java:788) at org.eclipse.wb.internal.swing.model.property.editor.models.table.TableModelPropertyEditor.openDialog(TableModelPropertyEditor.java:81) 在 org.eclipse.wb.internal.core.model.property.editor.TextDialogPropertyEditor$1.onClick(TextDialogPropertyEditor.java:35) 在 org.eclipse.wb.internal.core.model.property.editor.presentation.ButtonPropertyEditorPresentationImpl$4.handleEvent(ButtonPropertyEditorPresentationImpl.java:124)

应当指出的是

  • 即使我运行 JDK 11、15 或 17,我也会出现此错误。我甚至尝试了 Oracle JDK,正如一些人建议的那样

  • 我在本地链接了 JNI 文件,执行 ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

  • 我通过执行 sudo apt-get install libswt-gtk-4-jni libswt-gtk-4-java 安装了最新的 jni

  • 我在 Ubuntu 16 上测试了这个,并得到了同样的错误

我真的不知所措。这让我相信这是一个操作系统问题

答案1

一旦我将环境降级为 Eclipse Luna、WindowBuilder 1.9.0 和 Oracle 8 JDK,它就可以正常工作了。因此,它与最新的 eclipse 和 JDK 有关。我希望这能帮助遇到类似问题的其他人。无论如何,我很好奇为什么会失败!我喜欢尽可能使用最新的 eclipse。

相关内容