简体   繁体   English

在Eclipse中导出后,可运行的JAR文件未运行

[英]Runnable JAR file doesn't run after export in Eclipse

I have the following hierarchy : 我有以下层次结构:

在此处输入图片说明

When I export the project into a runnable JAR file (32 bit platform) , the file is created successfully , but when I try to run it , nothing happens - no response from the OS (windows 7 pro) . 当我将项目导出到可运行的JAR文件(32位平台)时,文件已成功创建,但是当我尝试运行它时,什么也没发生-操作系统没有响应(Windows 7专业版)。

Why can't I run the jar file ? 为什么我不能运行jar文件?

Thanks 谢谢

EDIT: 编辑:

C:\1>java -jar ex3.jar
Catched FileNotFoundException: C:\1\ex3-natives-windows-i586.jar (The system can
not find the file specified), while TempJarCache.bootstrapNativeLib() of jar:fil
e:/C:/1/ex3-natives-windows-i586.jar!/ (file:/C:/1/ + ex3-natives-windows-i586.j
ar)
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no gluege
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(JNILibLoad
erBase.java:442)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.ja
va:59)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNIL
ibLoaderBase.java:90)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.j
ava:328)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrar
y(DynamicLibraryBundle.java:390)
        at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:251)
        at com.jogamp.common.os.Platform.access$000(Platform.java:57)
        at com.jogamp.common.os.Platform$1.run(Platform.java:186)
        at com.jogamp.common.os.Platform$1.run(Platform.java:183)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:183)
        at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
        at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:246)
        at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:196)
        at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:186)
        at WorldController.<init>(WorldController.java:119)
        at WorldController$1.run(WorldController.java:478)
        at java.awt.event.InvocationEvent.dispatch(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 Sour
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)

C:\1>

Updated : 更新 :

C:\>
C:\>java -jar ex3.jar
Exception in thread "main" java.lang.IllegalAccessException: Class org.eclipse.j
dt.internal.jarinjarloader.JarRsrcLoader can not access a member of class WorldC
ontroller with modifiers "public static"
        at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
        at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(Unknown Sour
ce)
        at java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)

C:\>

It seems that you got a illegal call. 看来您接到了非法电话。 That means you try to call a method wich you're not allowed to call. 这意味着您尝试调用不允许调用的方法。 (referenced to your updated edit) (引用您的最新修改)

Your error says that you want to execute a method with the modifiers public static. 您的错误表明您要执行带有修饰符public static的方法。 A static method must be calls with the class name not with the object: 必须使用类名称而不是对象来调用静态方法:

SomeClass.staticMethodCall();

The following would be wrong: 以下是错误的:

SomeClass sc = new SomeClass();
sc.staticMethodCall();

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM