Problem while creating jar files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 123456prakash
    New Member
    • Jan 2007
    • 35

    Problem while creating jar files

    I have folder called bin in which i have put all my class files and the required jars file . I have 4 jarfiles

    I created a manifest file Test.txt inside the bin folder
    and the content is given below

    Manifest-Version: 1.0
    Main-Class: com.school.Main
    Class-Path: ./charsets.jar ./cryptix32.jar ./jfreereport-0.8.4_10-all_new.jar ./mysql-connector-java-3.0.8-stable-bin.jar

    from command promt i went to that bin folder and excuted

    jar cvfm Myproject.jar Test.txt *.*

    It created the jar file in inside the bin folder ... and if i double click jar
    when its in the bin folder it is working
    but if i take that jar from that folder and place in some other folder its
    not working. error saying
    Could not find the main class

    And if i copy those jar file which are required to the same folder where
    i have myproject.jar then it started working

    My doubt is i already bundled all the jar required in the same myproject
    jar . then y its not reading that jars.
    Is my classpath set in mainfest file wrong .. if yes how to set it
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by 123456prakash
    I have folder called bin in which i have put all my class files and the required jars file . I have 4 jarfiles

    I created a manifest file Test.txt inside the bin folder
    and the content is given below

    Manifest-Version: 1.0
    Main-Class: com.school.Main
    Class-Path: ./charsets.jar ./cryptix32.jar ./jfreereport-0.8.4_10-all_new.jar ./mysql-connector-java-3.0.8-stable-bin.jar

    from command promt i went to that bin folder and excuted

    jar cvfm Myproject.jar Test.txt *.*

    It created the jar file in inside the bin folder ... and if i double click jar
    when its in the bin folder it is working
    but if i take that jar from that folder and place in some other folder its
    not working. error saying
    Could not find the main class

    And if i copy those jar file which are required to the same folder where
    i have myproject.jar then it started working

    My doubt is i already bundled all the jar required in the same myproject
    jar . then y its not reading that jars.
    Is my classpath set in mainfest file wrong .. if yes how to set it
    I take it your jar file needs these jar files to work?

    ./charsets.jar ./cryptix32.jar ./jfreereport-0.8.4_10-all_new.jar ./mysql-connector-java-3.0.8-stable-bin.jar

    They need to be available in the folders you specified there for that to work.

    Comment

    • 123456prakash
      New Member
      • Jan 2007
      • 35

      #3
      Originally posted by r035198x
      I take it your jar file needs these jar files to work?

      ./charsets.jar ./cryptix32.jar ./jfreereport-0.8.4_10-all_new.jar ./mysql-connector-java-3.0.8-stable-bin.jar

      They need to be available in the folders you specified there for that to work.
      Ya i need these jar for my application to work .
      The problem is its not reading the jar files which r
      bundled inside the myproject.jar ...
      If i put the main jar n the required jar in one folder and if i double click its running

      Comment

      Working...