简体   繁体   English

Log4j java.lang.NoClassDefFoundError

[英]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.

相关问题 java.lang.NoClassDefFoundError:org / apache / log4j / Priority - java.lang.NoClassDefFoundError: org/apache/log4j/Priority java.lang.NoClassDefFoundError:org / apache / log4j / Priority - java.lang.NoClassDefFoundError: org/apache/log4j/Priority java.lang.NoClassDefFoundError:使用 log4j 速度自定义布局 - java.lang.NoClassDefFoundError: with log4j velocity custom layout java.lang.NoClassDefFoundError:org / apache / log4j / PropertyConfigurator - java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator log4j和java.lang.NoClassDefFoundError:org / apache / log4j / Layout - log4j and java.lang.NoClassDefFoundError: org/apache/log4j/Layout log4j2 java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager - log4j2 java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager java.lang.NoClassDefFoundError:org / apache / log4j / Level - slf4j? - java.lang.NoClassDefFoundError: org/apache/log4j/Level - slf4j? 尝试在插件类型项目中添加log4j。 错误:java.lang.NoClassDefFoundError:org / apache / log4j / PropertyConfigurator - Trying to add log4j in plugin type project. Error : java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator Hazelcast log4j 配置产生“java.lang.NoClassDefFoundError: org/apache/log4j/Logger”错误 - Hazelcast log4j configuration produces "java.lang.NoClassDefFoundError: org/apache/log4j/Logger" error Elasticsearch Java API错误java.lang.NoClassDefFoundError:org / apache / logging / log4j / Logger - Elasticsearch java api error java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM