Log4j java.lang.NoClassDefFoundError

I could not understand what caused 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 received log4j-1.2.8.jareverywhere in the project, but I could not do it. How can I remove this error? Thank!

+3
source share
2 answers

Well, you didn’t say what kind of application it was, or basically you gave us some kind of context. You must ensure that the log4j classes are accessible to the class loader loading your application. If this standalone application is launched from the command line, this is similar to the case of specifying a command line option -classpath. For instance:

java -classpath .;log4j-1.2.8.jar org.foo.MyApplication

If you can provide us with more information, we are likely to be able to help you.

+9
source

Setp 1:

2 ,

3 " "

4: jar

.

+2

Source: https://habr.com/ru/post/1775214/


All Articles