A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Joined: Feb 05, 2001
Jan 21, 2008 05:44:00
Ive packaged my POJO application in a JAR file together with its third party libraries such as Log4j.
The structure of the executable jar file is as follows:
jarFile1.jar -- Pojo.java (inside jarFile1.jar) -- log4j.jar (inside jarFile1.jar)
The issue Im having is that when I execute
java -jar jarFile1.jar
I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at com.Pojo.test.Pojo.<clinit>(Pojo.java:33)
Seems as if Pojo.java cannot find my log4j.jar files.
So the question is:
How do I set the classpath to refer to a library jar file (log4j.jar) that is contained in another jar file?
Thanks in advance!
Dominic Steng�rd<br />Sun Certified Java 2 Programmer
Joined: Nov 18, 2006
Jan 21, 2008 05:58:00
You can't nest .jar files. I was going to try:
but I haven't tried it yet.
I agree. Here's the link:
subject: Classpath issue
Accessing classes in other jars from my jar
Bugged with slf4j
Eclipse Plug-in and dependencies from other JARs
wierd logging issue with my app
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015