Log4j java.lang.NoClassDefFoundError
我无法理解导致此错误的原因:
ERROR>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
ERROR>Caused by: java.lang.ClassNotFoundException: org.apache.log4j.PropertyConfigurator
项目中的任何地方都已经有了 log4j-1.2.8.jar
但我无法做到。我怎样才能让这个错误消失?谢谢!
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. How can I make this error go away? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,您还没有说这是什么类型的应用程序,或者基本上没有给我们任何上下文。您需要确保 log4j 类可供加载应用程序的类加载器使用。如果它是从命令行运行的独立应用程序,则只需指定
-classpath
命令行选项即可。例如:如果您可以向我们提供更多信息,我们很可能能够为您提供更多帮助。
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. 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. For example:If you can give us more information, we're likely to be able to help you more.
Setp 1:右键单击您的主要方法
第2步转到作为选项运行然后
第3步转到运行配置
第4步:然后添加项目或jar文件
现在它可以工作了。
Setp 1 : right click on your main method
Step 2 go to run as option then
Step 3 go to Run configuration
Step 4: and add projects or jar files
now it works.