You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by henry human <he...@yahoo.de> on 2011/02/02 11:21:13 UTC
Get the following error: NoClassDefFoundError: org.apache.log4j.Logger
Hi
I get the following error when I try to call a smal java
application(hello friends!) which i placed in a jar file.
the application has the log4j.jar in its lib directory (and
classpath) and calls the log4j.logger like this:
private static final Logger LOGGER =
Logger.getLogger(Hello.class);
It works when i run the application in eclipse
but not when I pack it as a JAR application! (he
application is not running on tomcat an is only a smal
commandline application)
Error:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger
Thanks for your advice
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Get the following error: NoClassDefFoundError: org.apache.log4j.Logger
Posted by "James A. N. Stauffer" <st...@gmail.com>.
You need to add log4j.jar to your classpath.
James A. N. Stauffer http://jamesjive.blogspot.com
Are you good? Take the test at http://www.livingwaters.com/good/
On Wed, Feb 2, 2011 at 4:21 AM, henry human <he...@yahoo.de> wrote:
>
> Hi
> I get the following error when I try to call a smal java
> application(hello friends!) which i placed in a jar file.
> the application has the log4j.jar in its lib directory (and
> classpath) and calls the log4j.logger like this:
> private static final Logger LOGGER =
> Logger.getLogger(Hello.class);
> It works when i run the application in eclipse
> but not when I pack it as a JAR application! (he
> application is not running on tomcat an is only a smal
> commandline application)
>
> Error:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/log4j/Logger
>
> Thanks for your advice
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Get the following error: NoClassDefFoundError: org.apache.log4j.Logger
Posted by Jacob Kjome <ho...@visi.com>.
I presume you are running using something like?...
java -jar myapp.jar
Correct? Note that if you try to add "-classpath" as a command line switch
while using the "-jar" command line switch, it will be ignored. In this case,
you'll have to update your MANIFEST.MF file to include the Log4j library in
the "Class-Path". Otherwise, just run without the "-jar" switch and the
"-classpath" info will no longer be ignored.
Jake
On Wed, 2 Feb 2011 10:21:13 +0000 (GMT)
henry human <he...@yahoo.de> wrote:
>
> Hi
> I get the following error when I try to call a smal java
> application(hello friends!) which i placed in a jar file.
> the application has the log4j.jar in its lib directory (and
> classpath) and calls the log4j.logger like this:
> private static final Logger LOGGER =
> Logger.getLogger(Hello.class);
> It works when i run the application in eclipse
> but not when I pack it as a JAR application! (he
> application is not running on tomcat an is only a smal
> commandline application)
>
> Error:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/log4j/Logger
>
> Thanks for your advice
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org