Netbeans 7.2.1构建问题



我有以下问题:我制作了一个Java应用程序,它在Netbeans的运行时可以完全正常工作,但在构建后将无法工作。库被正确地包含在内,以下是尝试从命令行运行它后发生的情况:

Exception in thread "Thread-4" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at com.xuggle.ferry.JNIMemoryManager.<init>(JNIMemoryManager.java:861)
    at com.xuggle.ferry.JNIMemoryManager.<clinit>(JNIMemoryManager.java:860)
    at com.xuggle.mediatool.MediaWriter.<clinit>(MediaWriter.java:119)
    at com.xuggle.mediatool.ToolFactory.makeWriter(ToolFactory.java:149)
    at app.RepaintImpl$1.run(RepaintImpl.java:63)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    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:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 6 more

NB中的所有内容都设置为JDK7,我相信我的环境变量也很好:

CLASSPATH=C:Program FilesJavajre7lib*;C:Program FilesJavajre7bin*;
JAVA_HOME=C:Program FilesJavajdk1.7.0_09
PATH=C:Program FilesJavajdk1.7.0_09bin;...

这是构建日志,让我困扰的是Netbeans在.jar文件中创建了空目录:

ant -f "C:\Users\Wojtek\Documents\NetBeansProjects\VNC Streamer" clean jar
init:
deps-clean:
Updating property file: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildbuilt-clean.properties
Deleting directory C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuild
clean:
init:
deps-jar:
Created dir: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuild
Updating property file: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildbuilt-jar.properties
Created dir: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildclasses
Created dir: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildempty
Created dir: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildgenerated-sourcesap-source-output
Compiling 87 source files to C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildclasses
Note: C:UsersWojtekDocumentsNetBeansProjectsVNC StreamersrcappRepaintImpl.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying 1 file to C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildclasses
Copied 25 empty directories to 24 empty directories under C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuildclasses
compile:
Created dir: C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerdist
Copying 1 file to C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerbuild
Copy libraries to C:UsersWojtekDocumentsNetBeansProjectsVNC Streamerdistlib.
Building jar: C:UsersWojtekDocumentsNetBeansProjectsVNC StreamerdistVNC_Streamer.jar
To run this application from the command line without Ant, try:
java -jar "C:UsersWojtekDocumentsNetBeansProjectsVNC StreamerdistVNC_Streamer.jar"
jar:
BUILD SUCCESSFUL (total time: 7 seconds)

任何帮助都将不胜感激!

生成的jar和一个目录lib位于构建目录中。

因此类路径应该包含./lib。这可以在META-INF/MMANIFEST.MF的主jar中设置为类路径,因此不需要从命令行添加它。往罐子里拉7个拉链。

当前运行必须在(构建)目录中进行,该目录包含main jar和lib子目录。

顺便说一句,环境类路径不需要包含JRE的bin。

相关内容

  • 没有找到相关文章

最新更新