Home » , » How To Create An Executable JAR File

How To Create An Executable JAR File

Today I will show you how to create an executable jar file. I do not know whether this topic is introduced by any other member. Using this method one can build graphical user interface program with java which will behave similar to Executable files i.e., the program can be started with double clicks. It is an easy alternative. Otherwise to run a java program one has to run it through comand prompt(in windows) using java command or by creating java executalbes which are very difficult to make. So lets begin:
Frist of all, we will create a simple java application using java foundation class popularly known as java Swing. Let the file name be JarExample.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class JarExample {

private static void createAndShowGUI() {

JFrame frame = new JFrame("Window");

JLabel emptyLabel = new JLabel("");
emptyLabel.setPreferredSize(new Dimension(175, 100));
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);


public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {

Now compile the java file. JDK will produce two class files namely (a)JarExample.class ( JarExample$1.class.
All the years we have been doing this.Your question might be what new? Its coming.
Now we will create a Manifest File. If you have done java beans then you are quite familiar with the term.
Let write our Manifest File:-
The name of the file is :- jex.mf

Manifest-Version: 1.0
Main-Class: JarExample

We are now ready to create our JAR file.
create a folder, keep the class files (JarExample.class,JarExample$1.class) and the manifest file in that folder.
Now open command prompt. Say for example your folder name is jar and you have kept it in C DRIVE. Now change directory using CD jar command.
Now we will create jar file using following command.
c:\jar>jar cfm jarex.jar jex.mf *.class
It will create jarex.jar .
I wish you will be able to create jar file using this method.

Click Here To Compare Product

Search Result

OUR T-SHIRT STORE : http://www.zazzle.com/malaysiagiftsshop*,This page shows you how to create a jar file (java archive) using the Eclipse IDE. These instructions do not cover how to make an executable jar.,Creating an executable JAR file for a stand-alone SWT program is very similar to creating any executable JAR file, with one important difference.,How to Create a Java Executable Jar File: This is a tutorial that should help you learn how to make a jar file quickly and easily for all of your programs.,Distributing your Application as an executable JAR file. A JAR (Java ARchive) is a way of packaging together all of the resources associated with a program (class ,In this tutorial, we will show you how to create a executable JAR When you double click on it, it runs the defined main class in manifest file.,The extension "JAR" stands for "Java Archive." Archive-type formats store other files within them, in order to make the files smaller and easier to manage and ,How to Create an Executable Java Jar File in NetBeans If you wish to view this tutorial as a PDF, use the link below. This PDF does not have the FAQ section which may ,The Personal Self-Assessment Environment Creating executable jar files. Last modified: Fri Sep 3 09:55:32 HST 1999 A new and cool feature of Java2 is the ability to ,How to Create Executable JARs. The Java programming language has the ability to package related collections of application or applet files in a java archive, or JAR

0 komentar:

Poskan Komentar