Java Can';在Eclipse中使用库生成可执行JAR文件
我正在尝试将我的项目导出为可执行的jar,除了一件事之外一切都很好:有两个窗口——第一个是主jframe,第二个是使用jzy3d库制作3D曲面的jframe;第一个窗口包含用于执行第二个jframe的按钮“Show”。当我在Eclipse中执行这个项目时,它工作得很好,但是当我制作可执行jar时,它就被执行了,但是如果我单击“Show”按钮,第二个jframe就不会打开。那么,请告诉我,我该如何修复它 更新:来自cmd的信息:Java Can';在Eclipse中使用库生成可执行JAR文件,java,eclipse,Java,Eclipse,我正在尝试将我的项目导出为可执行的jar,除了一件事之外一切都很好:有两个窗口——第一个是主jframe,第二个是使用jzy3d库制作3D曲面的jframe;第一个窗口包含用于执行第二个jframe的按钮“Show”。当我在Eclipse中执行这个项目时,它工作得很好,但是当我制作可执行jar时,它就被执行了,但是如果我单击“Show”按钮,第二个jframe就不会打开。那么,请告诉我,我该如何修复它 更新:来自cmd的信息: Catched FileNotFoundException: C:\
Catched FileNotFoundException: C:\destination-natives-windows-i586.jar (═х єфр
ё эрщЄш єърчрээ√щ Їрщы), while TempJarCache.bootstrapNativeLib() of jar:file:
:/destination-natives-windows-i586.jar!/ (file:/C:/ + destination-natives-wind
s-i586.jar)
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no glue
n-rt in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLo
erBase.java:454)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.
va:59)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JN
ibLoaderBase.java:90)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase
ava:328)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibr
y(DynamicLibraryBundle.java:390)
at com.jogamp.common.os.Platform$2.run(Platform.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:231)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:183)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:99)
at org.jzy3d.global.Settings.<init>(Settings.java:12)
at org.jzy3d.global.Settings.getInstance(Settings.java:21)
at com.nda.fuzzy.views.SurfaceViewerFrame.<init>(SurfaceViewerFrame.ja
:102)
at com.nda.fuzzy.views.MainFrame$26.actionPerformed(MainFrame.java:579
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknow
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown So
ce)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown So
ce)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown So
ce)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
捕获的FileNotFoundException:C:\destination-natives-windows-i586.jar(═х єфр
ё эрщЄш єърчрээ√当jar:file的TempJarCache.bootstrapNativeLib()时:
:/destination-natives-windows-i586.jar!/(文件:/C:/+目的地本地人风
s-i586.jar)
线程“AWT-EventQueue-0”java.lang.UnsatifiedLink中出现异常错误:无粘合
java.library.path中的n-rt
位于java.lang.ClassLoader.loadLibrary(未知源)
位于java.lang.Runtime.loadLibrary0(未知源)
位于java.lang.System.loadLibrary(未知源)
在com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLo
java:454)
在com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase)。
弗吉尼亚州:59)
在com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JN
java:90)
在com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase
ava:328)
位于com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibr
y(DynamicLibraryBundle.java:390)
com.jogamp.common.os.Platform$2.run(Platform.java:249)
位于java.security.AccessController.doPrivileged(本机方法)
位于com.jogamp.common.os.Platform.LoadGlueGenrTempl(Platform.java:231)
位于com.jogamp.common.os.Platform(Platform.java:183)
位于javax.media.opengl.GLProfile.(GLProfile.java:99)
在org.jzy3d.global.Settings。(Settings.java:12)
位于org.jzy3d.global.Settings.getInstance(Settings.java:21)
在com.nda.fuzzy.views.SurfaceViewerFrame.(SurfaceViewerFrame.ja
:102)
在com.nda.fuzzy.views.MainFrame$26.actionPerformed(MainFrame.java:579
在javax.swing.AbstractButton.fireActionPerformed(未知源)
位于javax.swing.AbstractButton$Handler.actionPerformed(未知源)
在javax.swing.DefaultButtonModel.fireActionPerformed(未知源)
位于javax.swing.DefaultButtonModel.setPressed(未知源)
位于javax.swing.AbstractButton.doClick(未知源代码)
位于javax.swing.plaf.basic.BasicMenuItemUI.doClick(未知源代码)
在javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(未知
(来源)
位于java.awt.Component.ProcessMouseeEvent(未知源)
位于javax.swing.JComponent.ProcessMouseeEvent(未知源)
位于java.awt.Component.processEvent(未知源)
位于java.awt.Container.processEvent(未知源)
位于java.awt.Component.dispatchEventImpl(未知源)
位于java.awt.Container.dispatchEventImpl(未知源)
位于java.awt.Component.dispatchEvent(未知源)
位于java.awt.LightweightDispatcher.RetargetMouseeEvent(未知源)
位于java.awt.LightweightDispatcher.ProcessMouseeEvent(未知源)
位于java.awt.LightweightDispatcher.dispatchEvent(未知源)
位于java.awt.Container.dispatchEventImpl(未知源)
位于java.awt.Window.dispatchEventImpl(未知源)
位于java.awt.Component.dispatchEvent(未知源)
位于java.awt.EventQueue.dispatchEventImpl(未知源)
位于java.awt.EventQueue.access$200(未知源)
在java.awt.EventQueue$3.run处(未知源)
在java.awt.EventQueue$3.run处(未知源)
位于java.security.AccessController.doPrivileged(本机方法)
位于java.security.ProtectionDomain$1.doIntersectionPrivilege(未知So
(行政长官)
位于java.security.ProtectionDomain$1.doIntersectionPrivilege(未知So
(行政长官)
在java.awt.EventQueue$4.run处(未知源)
在java.awt.EventQueue$4.run处(未知源)
位于java.security.AccessController.doPrivileged(本机方法)
位于java.security.ProtectionDomain$1.doIntersectionPrivilege(未知So
(行政长官)
位于java.awt.EventQueue.dispatchEvent(未知源)
位于java.awt.EventDispatchThread.pumpOneEventForFilters(未知源)
位于java.awt.EventDispatchThread.pumpEventsForFilter(未知源)
位于java.awt.EventDispatchThread.pumpEventsForHierarchy(未知源)
位于java.awt.EventDispatchThread.pumpEvents(未知源)
位于java.awt.EventDispatchThread.pumpEvents(未知源)
位于java.awt.EventDispatchThread.run(未知源)
可能在命令行中您没有指定jzy3d库的类路径 您可以使用lib运行jar文件:
"java -cp libs/* -jar program.jar"
将lib(jzy3d.jar)放在libs文件夹中的位置
如果您使用了一些特殊的工具来创建一个可执行的jar文件,
然后,您必须配置该工具以包括要在exe中使用的jzy3d.jar库。您需要执行以下操作之一: