Make and execute .jar-file

J

Java

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
 
T

Thomas Weidenfeller

Java said:
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
 
B

Brian

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
 
F

Finn Jensen

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top