2013-05-20 176 views
2
出口後運行

我有以下層次:運行的JAR文件沒有在Eclipse

enter image description here

當我出口項目進入可運行的JAR文件(32位平臺),在文件被創建 但是當我嘗試運行它時,沒有任何反應 - 操作系統沒有響應(Windows 7專業版)。

爲什麼我不能運行jar文件?

感謝

編輯:

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> 

更新時間:

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:\> 
+1

使用'運行在命令提示罐子Java的罐子 '並檢查是否有任何例外。 –

+0

@Karthikeyan:我將它添加到帖子中,但也有例外,但據說失蹤的文件存在。 – ron

+0

在eclipse中導出可運行jar時,使用「將所需庫管理器打包成JAR」,然後嘗試。 –

回答

1

看來你得到了一個非法調用。這意味着你嘗試調用一個你不允許調用的方法。 (參考您的更新編輯)

您的錯誤表示您想要使用修飾符public static執行一個方法。靜態方法必須與類名不與所述對象的調用:

SomeClass.staticMethodCall(); 

以下將是錯誤的:

SomeClass sc = new SomeClass(); 
sc.staticMethodCall(); 
相關問題