现象,执行时抛出java.lang.ClassNotFoundException异常:
Executing E:\secondegg\secondegg-reversi\dist\run802221143\secondegg-reversi.jar using platform D:\Program Files\Java\jdk1.7.0_25\jre/bin/java Exception in Application init method java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.javafx.main.Main.launchApp(Main.java:642) at com.javafx.main.Main.main(Main.java:805) Caused by: java.lang.RuntimeException: Exception in Application init method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:398) at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47) at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115) at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.NoClassDefFoundError: com/secondegg/core/network/P2PNetwork at com.secondegg.reversi.ReversiMain.init(ReversiMain.java:35) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:296) ... 3 more Caused by: java.lang.ClassNotFoundException: com.secondegg.core.network.P2PNetwork at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 5 more Java Result: 1
发现其生成的可执行jar包的MANIFEST.MF的JavaFX-Class-Path: 项为空导致。
正常情况下的MANIFEST.MF的内容
Manifest-Version: 1.0 JavaFX-Version: 2.2 implementation-vendor: admin implementation-title: reversi implementation-version: 1.0 JavaFX-Application-Class: com.secondegg.reversi.ReversiMain JavaFX-Class-Path: lib/bcprov-jdk15-145.jar lib/derby-10.5.1.1.jar lib /felix.jar lib/h2-1.2.127.jar lib/javax.servlet.jar lib/jxse-2.6.jar lib/netty-3.1.5.GA.jar lib/org.mortbay.jetty.jar lib/secondegg-core.j ar lib/secondegg-network.jar Created-By: JavaFX Packager Main-Class: com/javafx/main/Main
问题MANIFEST.MF的内容
Manifest-Version: 1.0 JavaFX-Version: 2.2 implementation-vendor: cuizhf implementation-title: secondegg-reversi implementation-version: 1.0 JavaFX-Application-Class: com.secondegg.reversi.ReversiMain JavaFX-Class-Path: Created-By: JavaFX Packager Main-Class: com/javafx/main/Main
目前尚不知是Netbeans的bug,还是其他问题,今天太晚了,OK,休息先!
———————————————————————————————————————————————————————————————————————
重新创建项目就好了。。。
——————————————————————————————————
傲轩游戏网
傲轩游戏网