creating a jar with an external library

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eagles
    New Member
    • Jun 2007
    • 4

    #1

    creating a jar with an external library

    I have a program that reads and writes tiff files. I have JAI ImageIO installed on my computer and the program works fine. But when I create a jar and try to run it on another computer I can't read or write tiffs. I'm not sure what I have to do to get this to work on other computers.

    Here's what I have tried:
    I created a directory lib (containing clibwrapper_jii o.jar and jai_imageio.jar ), in the directory with the .class files. Then I added
    Class-Path: lib\clibwrapper _jiio.jar lib\jai_imageio .jar
    to my Manifest.txt.
    Then I used
    jar cmf Manifest.txt myjar.jar *.class

    But the jar does not work on other computers. Does anyone know what I am doing wrong. Thanks.
  • praveen2gupta
    New Member
    • May 2007
    • 200

    #2
    Originally posted by eagles
    I have a program that reads and writes tiff files. I have JAI ImageIO installed on my computer and the program works fine. But when I create a jar and try to run it on another computer I can't read or write tiffs. I'm not sure what I have to do to get this to work on other computers.

    Here's what I have tried:
    I created a directory lib (containing clibwrapper_jii o.jar and jai_imageio.jar ), in the directory with the .class files. Then I added
    Class-Path: lib\clibwrapper _jiio.jar lib\jai_imageio .jar
    to my Manifest.txt.
    Then I used
    jar cmf Manifest.txt myjar.jar *.class

    But the jar does not work on other computers. Does anyone know what I am doing wrong. Thanks.
    Hi
    Try following command
    jar cvf Manifest.txt myjar.jar *.class

    I think it's version related problem . cvf will prepare jar file of standard output.

    Comment

    • eagles
      New Member
      • Jun 2007
      • 4

      #3
      Thanks, but I still isn't working. Does JAI Imageio need to be installed separately on every computer that runs the .jar? If it does then I don't understand what the Class-Path line in the manifest is for. I can't seem to find any information on this. Any help would be appreciated. Thanks.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by eagles
        Thanks, but I still isn't working. Does JAI Imageio need to be installed separately on every computer that runs the .jar? If it does then I don't understand what the Class-Path line in the manifest is for. I can't seem to find any information on this. Any help would be appreciated. Thanks.
        From what I understood from your question: yes; if your jar A uses another jar
        B then both jars A and B have to be present on the system on which your
        application is supposed to run. Of course you can play tricks big times if your
        classes load other classes using the URLClassLoader. Otherwise just install
        both A and B jars on a local system and make a classpath point to them.

        kind regards,

        Jos

        Comment

        Working...