Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

executable jar

  Asked By: Craig    Date: Jul 12    Category: Java    Views: 537

How do i create an executable jar? If if i do, does the machine on
which my program runs need java 1.4?



1 Answer Found

Answer #1    Answered By: Ulfah Hashmi     Answered On: Jul 12

First you need a manifest file. This just tells the jar  which
classes 'main' is to be run when the file is double-clicked on. The
manifest file is usually two lines:

Manifest-Version: 1.0
Main-Class: FileToBeRun

(Although you can probably leave out the version number.)
Note lack of extension on 'FileToBeRun'.

Then, at the command prompt, type:
jar -cmf MyProgManifest.txt MyProg.jar *.class

The options after -cmf must come in that order too.

Didn't find what you were looking for? Find more on executable jar Or get search suggestion and latest updates.