• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with jar  RSS feed

Rupali Desai
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following classes in my application and prepared a jar file using the following command
C:\ACG_JAVA>jar cvfm ACG1.jar Manifest.mf *.class
added manifest
adding: ACG.class(in = 21644) (out= 9466)(deflated 56%)
adding: Acg_xxa_reference.class(in = 5748) (out= 3287)(deflated 42%)
adding: ACGBadInputParameterException.class(in = 438) (out= 263)(deflated 39%)
adding: ACGConstant.class(in = 7434) (out= 2628)(deflated 64%)
adding: ACGException.class(in = 592) (out= 331)(deflated 44%)
adding: ACGFatalException.class(in = 414) (out= 250)(deflated 39%)
adding: ACGOutputType.class(in = 642) (out= 392)(deflated 38%)
adding: ACGParameter.class(in = 23927) (out= 8654)(deflated 63%)
adding: ACGReference.class(in = 5926) (out= 3125)(deflated 47%)
adding: ACGRuntimeMessage.class(in = 996) (out= 481)(deflated 51%)
adding: KeyValuePair.class(in = 363) (out= 255)(deflated 29%)
adding: TokenizeQueryString.class(in = 1932) (out= 1022)(deflated 47%)
The Manifest.mf reads like this
Manifest-Version: 1.0
Created-By: 1.4.0_01 (Sun Microsystems Inc.)
Class-Path: c:\tomcat\lib\common\servlet.jar
Main-Class: Acg_xxa_reference
When I try to execute the jar file as folllows
C:\ACG_JAVA>java -jar ACG1.jar
I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: Acg_xxa_reference

What am I doing wrong
Rupali Desai
Dan Richardson
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the problem is with your Class-Path attribute. From what I've read on the jar spec, this only accepts relative URL's. You could try the following:
Class-Path: ../tomcat/common/lib/servlet.jar
if you want to keep the same directory structure. Or for testing purposes, copy the servlet.jar over to your directory and simply refer to it as the following:
Class-Path: servlet.jar
and see what happens. Based on the tests I've run on my machine, either of these should work.
NOTE: I think you may have had your common and lib folders mixed up. I believe the default Tomcat installation uses ...common/lib instead of ..lib/common.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!