deploying JAR files on a windows platform

Hie

Guys, I have developed my software to completion very well. Now the problem is that I want to deploy it to another machine, such that only the excecutable files will run. The program was developed using nebeans IDE 5.0 and I created a JAR file. Now I dont what to do next with the JAR file. I have been on the internet serching for the solution to this but the ideas I was given were not working, for example going to the command prompt and run it as java -jar <application name>

.

I am asking for anyone who has the ides to contribute and help me in development of this system.

Thanx in advance

[637 byte] By [kernana] at [2007-10-2 20:13:37]
# 1

Your above should work. However, you need to specify the main class in the jar file's manifest file.

Also, you will need to specify the class paths (preferably in the manifest file).

-jar

Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial for information about working with Jar files and Jar-file manifests.

When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.

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

BaltimoreJohna at 2007-7-13 22:55:45 > top of Java-index,Java Essentials,Java Programming...
# 2

Netbeans 5.0 puts the jar it creates in a directory called 'dist'

Go to that directory, and check that java -jar whatever.jar works from there. It should. Now look for a subdirectory called lib - if that exists, it will contain any jar that you application depends on (including the ones that Netbeans adds, such as support for the Matisse GUI builder).

If the lib dir is there, you will need to copy the whole of the dist directory to the target machine, keeping the lib dir. in the same relative position, as the main jar manifest will point to them there.

If this doesn't work, post the exceptions/errors you are getting.

armalcolma at 2007-7-13 22:55:45 > top of Java-index,Java Essentials,Java Programming...
# 3
To make it convenient to run (assuming a swing application) create a link to javaw in the JVM's bin directory, then edit the link properties, add the -jar my.jar to the command, and set the working directory to the dist directory.
malcolmmca at 2007-7-13 22:55:45 > top of Java-index,Java Essentials,Java Programming...
# 4

Just another stumbling block, FYI...

Double-clicking on the JAR will work if the user has installed a JVM on their machine unless some other rude application *cough cough WinRAR cough* decides to steal the file association for it.

I think these sorts of minutia are why it's pretty common for Windows distributions of Java applications to be wrapped in a native installer (i.e., InstallAnywhere?).

tvynra at 2007-7-13 22:55:45 > top of Java-index,Java Essentials,Java Programming...