NoClassDefFound when trying to run java with external libraries

牧云@^-^@ 提交于 2019-12-02 02:17:10

When using java -jar ..., the -classpath argument is ignored. Either specify all necessary jars in the manifest of your main jar (but you can only use relative paths there), or add your main jar to the -classpath and mention the main class on the command line.

Yes, I don't like this, too.

SRV_LIBS points to log4j-1.2.16-javadoc.jar

Usually the "-javadoc" in the name means that the jar contains no code - only javadoc documentation. Try log4j-1.2.16.jar instead.

It looks like you're pointing to the wrong log4j jar.

You currently have -classpath server\libraries\log4j-1.2.16-javadoc.jar; which tries to load the javadoc jar file.

Try using -classpath server\libraries\log4j-1.2.16.jar; instead.

For starters, you are using the log4j javadoc jar. That only contains javadoc documentation and not any class files. You need to be using log4j-1.2.16.jar.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!