0

I have created my JAR on Windows 2000 having java version 1.5 which contains following directories/files:

  • manifest.txt
  • com
  • lib

lib contains all JARS which I want to make part of my JAR. com contains my class files and below is manfiest.txt file

Main-Class: com.as.qst.result.ResultTriggerSchedular 
Class-Path: lib/axis.jar lib/c3p0-0.9.1.1.jar lib/commons-discovery-0.2.jar lib/commons-logging-1.0.4.jar lib/jaxrpc.jar lib/log4j-1.2.16.jar lib/medplus-hub-8.2-wsclients.jar lib/medplus-hub-13.1-jaxws-clients.jar lib/quartz-2.2.1.jar lib/quartz-jobs-2.2.1.jar lib/saaj.jar lib/slf4j-api-1.6.6.jar lib/slf4j-log4j12-1.6.6.jar lib/ wsdl4j-1.5.1.jar lib/xercesImpl.jar com\as\qst\result

I used following command to generate my JAR

  jar cvfm test.jar manifest.txt com lib

It has successfully created a JAR file but when I try to run it with

java -jar test.jar

it does not execute and throws above exception. I used the same process for Windows 7 which has version 1.7 and it did work out even without class files path in manifest.txt com\as\qst\result. Is something more to do with class-path besides defining in manifest? and why is it working in Windows 7?

aneela
  • 1,457
  • 3
  • 24
  • 45

1 Answers1

1

You do not need the class file path in your class path entry. So instead of adding com\as\qst\result to your class-path.

More over you must not package other jar files in your runnable jar.

Other required jars must be provided in the same folder as your jar file (may be in separate folder) and Add current directory "." (without quotes) to your class-path.

Hope this helps.

EDIT

Just found this Stackoverflow Link. This might give you more insight. Please read through it.

Community
  • 1
  • 1
Sanjeev
  • 9,876
  • 2
  • 22
  • 33
  • I did change my class-path to add `./` to all jars and not package these jars to my jar. but it still gives same exception. I read link too which says that when main class name in manifest was completed, at least tool was able to find main class which is not happening in my case. It will read others jar after finding my main class. – aneela May 16 '14 at 06:41
  • did you add current directory to your class-path? – Sanjeev May 16 '14 at 13:03