Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes How do I deploy my application using a jar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How do I deploy my application using a jar?" Watch "How do I deploy my application using a jar?" New topic
Author

How do I deploy my application using a jar?

TJ Hylton
Greenhorn

Joined: Jul 27, 2002
Posts: 12
I have seen questions and (limited)examples on various places on the web but I am yet to see an example that shows how to create a manifest file that includes a main class file and a number of others(including inner classes),gif or jpeg images
and or sounds. i would love to create an application that only requires double clicking an icon to start it. please give me a detailed example of creating jar files.
thanx


TJ Hylton
Keivin Xu
Greenhorn

Joined: Mar 21, 2002
Posts: 4
http://java.sun.com/docs/books/tutorial/jar/basics/run.html
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Of you can use a .bat/.sh file with the instructions on invoking your application. This can then be hooked to an icon for starting with a click.


"JavaRanch, where the deer and the Certified play" - David O'Meara
TJ Hylton
Greenhorn

Joined: Jul 27, 2002
Posts: 12
Cindy how do i create a .bat/sh file? and how do i use the icon? details please.
Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
For the bat file open up notepad and save as "***.bat", that is a bat file. Now here is what I put in mine:
cd c:\
c:\jdk1.3.1_02\bin\java dmsi.campaignbuilder.CampaignBuilder
Note: I have not set my classpath and I am running a application in a jar file.
To see how I was able to jar this application, there is a thread under the beginners forum from about 1-2 days ago. Hope this helps.
Dean
Jon Dornback
Ranch Hand

Joined: Apr 24, 2002
Posts: 137
.bat and .sh files are scripting files for windows and linux/unix (respectively). they are just text files that contain a list of commands to be run. try this:
open up notepad, type in "echo hello world!" then save as "hello.bat". go to command prompt (start, run, type in "command" if you are on win9x, or "cmd" if you are on win2k) then change to the directory where the hello.bat file is. type in "hello.bat" and press enter. it will print out "hello world".
for more info, do a search for "batch file tutorial" on your favorite search engine.


use the [CODE] tags - it makes it much easier for people to help you.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
For a simple case where there is no jar file no other jar files to consider (and the jdk is in c:\dir\jre\bin - but you can change that) you have 3 commands. 1 Get to the correct directory. 2 - Set the path. 3 Call java (or javaw) with a classpath parameter (most likely) and name the class to execute.
In file Appl.bat you put:
cd \dir
path = .;C:\dir;C:\dir\jre\bin;
"c:\dir\jre\bin\javaw" -classpath .;"c:\dir" Appl

For a complicated example that has the runtime stuff embedded in the HUGE classpath statement, and is expecting a properties file in- something like this (still 3 commands):
cd \dir
path = .;C:\dir;C:\dir\jre\bin;
"c:\dir\jre\bin\javaw" -classpath .;"c:\dir";"c:\dir\Appl.jar";"c:\dir\deploy.jar";"c:\dir\jre\lib\rt.jar";"c:\dir\jre\lib\jaws.jar";"c:\dir\jre\lib\i18n.jar";"c:\dir\classes12.jar";"c:\dir\images" Appl.someSubDirectory.Appl "c:\dir\APPl.properties"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I deploy my application using a jar?
 
Similar Threads
Jar file creation using eclipse
How to create executable jar file?
Execuatable JAR file - javaw
how to create deployable jar file for Websphere3.5
how to create runnable JAR file