Skip to content
September 15, 2009 / Narayan

How to make Jar files and executable

Actually the jar files are the bundled file of all the classes, images and other resources which are need for running java application. Most of the JAR files are used for J2ME(Mirco Edition) purpose, i mean at Mobile Devices where java is compatible.
The JAR files can be easily made from numerous of processes but among them i’m going to demonstrate here through IDE NetBeans for creating JAR file and executable.

For making JAR files you must have following requirements:

  1. Java preinstalled  (1.5 or greater)
  2. Windows Platform
  3. One Manual Project which contains Swing Component or Applet

Ok now let’s begin to Bundle our Files in JAR format.

Firstly run NetBeans and make one Project which displays GUI .
Now Open the project which u downloaded or just use your own Project.

Press Ctrl+1 for enabling Project Tab and you can see your project there:

As shown in figure.


Now you can right click on the your Project Root and click Properties.

A new Dialog Box will appear.

Project Properties

Project Properties

Project Properties

STEP 1: Now expand Build tree and click on Packaging on Packaging you can see where the jar is to be saved.

On Default it keeps jar files at dist folder of our Project Directory.

STEP 2: Now Click on  to the Application tree and click Web Start now on right side you can see the check box

Enable Web Start’ check the box.

STEP 3: Move towards Run tree now you can specify which class you want to execute for jar file.

Change Main-Class: Class File(packageName.classFileYouWantToExecute)

foreg: loginpanel.Main

Specify the Class File you want to run or execute..

(For the LoginPanel project please type change loginpanel.Main to loginpanel.LoginPanel )

After specifying the class file you want to load then, make sure the option ‘Run with Java Web Start’ is checked.

After that Click on OK now you can Build your JAR file by pressing Shift+F11.

Now you can see a jar file in your directory (on default /dist) and open the JAR file (as sample LoginPanel.jar) .

You must see a new Window displayed at your screen .Your JAR file is now Sucessfully Executed !


Thank you for taking participation on  this blog .

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: