[英]Log4j java.lang.NoClassDefFoundError
I couldnt understand what is causing this error: 我无法理解导致此错误的原因:
ERROR>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
ERROR>Caused by: java.lang.ClassNotFoundException: org.apache.log4j.PropertyConfigurator
Already got the log4j-1.2.8.jar
everywhere in the project but I couldnt make it. 已经在项目的任何地方都得到了
log4j-1.2.8.jar
,但我无法做到。 How can I make this error go away? 如何让这个错误消失? Thanks!
谢谢!
Well, you haven't said what kind of application this is or basically given us any context. 好吧,你还没有说过这是什么样的应用程序,或者基本上给了我们任何上下文。 You need to make sure that the log4j classes are available to the classloader which is loading your application.
您需要确保log4j类可用于加载应用程序的类加载器。 If it's a standalone application run from the commandline, that's like to just be a case of specifying the
-classpath
command-line option. 如果它是从命令行运行的独立应用程序,那就像是指定
-classpath
命令行选项的情况。 For example: 例如:
java -classpath .;log4j-1.2.8.jar org.foo.MyApplication
If you can give us more information, we're likely to be able to help you more. 如果您可以向我们提供更多信息,我们可能会为您提供更多帮助。
Setp 1 : right click on your main method Setp 1:右键单击主方法
Step 2 go to run as option then 第2步然后选择运行
Step 3 go to Run configuration 步骤3转到运行配置
Step 4: and add projects or jar files 第4步:添加项目或jar文件
now it works. 现在它有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.