Make and execute .jar-file

Discussion in 'Java' started by Java, Apr 20, 2005.

  1. Java

    Java Guest

    Hello,

    I have developed an application - and want to distribute it in a jar-file.
    But I have face some problems create and executing the jar-file.

    The application is split up in four different package, but the main-method i
    in the root of these package. Additional i do also have som archives which I
    include in the classpath when i compile the project. (Axis.jar,mail.jar,
    activation.jar etc)

    How du I create the jar-fil, and what should I put in the MANIFEST.MF, and
    what about the jar-archives?

    The user of the application has a configuration file. When the user change
    something in the setup the changes are written to the configurationfil. Can
    the user stille edit the configurationfile - if it is put in the
    jar-archive?

    Thanks,

    Btian
    Java, Apr 20, 2005
    #1
    1. Advertising

  2. Java wrote:

    > How du I create the jar-fil,


    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jar.html

    > and what should I put in the MANIFEST.MF,


    http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html

    > and
    > what about the jar-archives?


    Keep them separate. For convenience, you might want to wrap all jars in
    some installer, or use JavaWebStart for deployment.

    It is in general possible, but not a great idea, to unpack them, repack
    them as part of your own jar, and only deliver your own big-fat jar.

    > The user of the application has a configuration file. When the user change
    > something in the setup the changes are written to the configurationfil. Can
    > the user stille edit the configurationfile - if it is put in the
    > jar-archive?


    Only with great difficulty: Each write would require to unpack the whole
    jar in some temporary directory, replace that one file and repack the
    jar - assuming the user has write permission to the jar, which is not a
    good idea for a centrally installed application.

    User config files belong into or below the user's home directory (there
    is a system property for getting a user's home directory - if there is
    one). On Unix the properties file would typically be a hidden dot-rc
    file of the name ".<your-application-name>rc". If you don't want to mess
    with files, consider the resources API.

    Global application specific (not user specific) config files belong in
    some location which is shared the same way like the location in which
    the jar is installed. E.g. if the jar resides on some file server, the
    global application specific config file should best be shared the same way.

    System specific config files (config data overriding global application
    specific config data on a per-host level) should go into some
    host-specific configuration location. E.g. on Unix this is often the
    /etc directory.

    /Thomas

    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
    Thomas Weidenfeller, Apr 20, 2005
    #2
    1. Advertising

  3. Java

    Brian Guest

    Hello again,

    Yes - i have tried to read those - and I now make a -Jar archive and tries
    to execute but, et seems like i can findes the files ind the achive. When I
    look in the achive all the files are there - but the JVM can find either the
    jar-files from the Class-Path og the .class-files. Is there somthing wrong
    with mig MANIFEST:MF?

    MANIFEST:MF:
    Manifest-Version: 1.0
    Main-Class: CVR
    Class-Path: poi-2.5.1-final-20040804.jar
    poi-contrib-2.5.1-final-20040804.jar poi-scratchpad-2.5.1-final-20040804.jar

    Name: CVR/Conf/Config.class

    Name: CVR/IO/Filehandler$JavaFilter.class

    Name: CVR/IO/Firm.class

    Name: CVR/IO/Save.class

    Name: CVR/IO/Filehandler.class

    Name: CVR/IO/Load.class

    Name: CVR/IO/Sheet.class

    Name: CVR/Events/About.class

    Name: CVR/Events/Exit.class

    Name: CVR/Events/MsgBox.class

    Name: CVR/Events/Printpage$Document.class

    Name: CVR/Events/Printpage.class

    Name: CVR/Events/CertificateReader.class

    Name: CVR/Events/Help.class

    Name: CVR/Events/Printpage$1.class

    Name: CVR/Events/Printpage$IntroPage.class

    Name: CVR/Events/Update.class

    Name: CVR/Lang/Danish.class

    Name: CVR/Lang/Language.class

    Name: CVR/Lang/English.class

    Name: Frame1.class

    Name: CVRFrame$2.class

    Name: CVRFrame.class

    Name: Frame1$ActionListenerHandler.class

    Name: Frame1$MouseListenerHandler.class

    Name: CVRFrame$1.class

    Name: CVR.class
    Brian, Apr 20, 2005
    #3
  4. Java

    Finn Jensen Guest

    Hello,

    My mistake:) I was trying til include af jar-file in af jar-file.

    When I keep it simple it works

    Is it possible to jo have at jar-file in a jar-file and use it as if is was
    placed outside?

    Brian
    Finn Jensen, Apr 25, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    567
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,718
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,752
    Roedy Green
    Feb 14, 2006
  4. Arnold Peters
    Replies:
    0
    Views:
    657
    Arnold Peters
    Jan 5, 2005
  5. Sriram
    Replies:
    1
    Views:
    1,039
Loading...

Share This Page