Question:
Including lib within my JAR file?
Jon T
2008-09-23 11:46:11 UTC
I am using the Eclipse IDE to create a JAR file that I need to schedule a cron job against. The program runs fine within the IDE but when I create the JAR and try to run it does nothing. The command line (in Windows) gives me a "NoClassDefFoundError: org/apache/commons/logging/LogFactory" I can't seem to get my jar command to work in the command line so that hasn't worked. I have found some forums that say "Class-Path: included.jar" but only for JARs outside the package.

Within the JAR I created all the included JAR files are in the base directory, not within any sub-directory.
Three answers:
deonejuan
2008-09-23 12:31:53 UTC
I've run into this. Mainly with images/ folder.



You have to change the MANIFEST file to point to the class with the main(). And, to do this manually you quickly learn java will look down through a stack of folders, but to look up???? I'm surprised Eclipse isn't packaging with the Manifest (and, we can't edit MANIFEST like a text document).



Within the IDE, the code will run because the IDE slams the pathnames to each resources into the java command-line. It can be crazy!!!! trying to get .jar to execute.



Link below about what I'm talking about.
Ramesh Mayala
2008-09-23 12:04:34 UTC
Its possible that ur jar file might be corrupted.



-- Try this

-Run jar -xvf . Make sure ur jar is present in the same folder.



-If the above command can't list contents of ur file it means ur jar is not created properly.



U can also create jar file using jar utility on ur command prompt.
campanelli
2016-11-30 06:58:29 UTC
Apache is the open source internet server that runs on in simple terms about all systems. Tomcat or Jakarta Tomcat is the Java servlet container that helps it to run Java servlets or jsp.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...