How to create .jar file in netbeans?

UPDATED: 17 December 2011
Why one need to create .jar file? / What .jar file contains? / What is .jar file?
         In single line i can say that; .jar file is collection of compiled .class files. Java is robust language and platform independence. Concept of .jar file came into the picture to support high level of understanding between developers. Develop class(Java Programs) under multiple package and  bind into .jar file. Methods can be accessible by creating object of that class. To achieve clarity of any project .jar file provides perfect concept. Below image shows usage of .jar file
.jar work flow
Usage of .jar file
Now i'll show you step by step procedure how you can create .jar file in netbeans. Hope all you have basic knowledge of creating project in netbeans.

  • Right click on project and Set as Main Project
Netbeans set as main project
Set as Main Project
  • Go to Run > Clean and Build Main Project
clean and build netbeans
Clean and Build Main Project
  • You have your .jar file. Below image show the location of your .jar file. It'll be displayed in output console.
Netbeans output

Thats it you have your .jar file ready to use.

3 comments :

  1. great tutorial,I didn't know its that easy in netbeans. by the way I have also shared some tips around how to create executable jar in java and how to view contents of jar file. you may find interesting.

    ReplyDelete
  2. You told about jar file in short but descriptive. I have also post on How to create jar file using NetBeans with screen shots and stepwise execution check out following link.

    http://eadvertisements.blogspot.in/2012/04/how-to-create-jar-file-in-netbeans.html

    Hope you find best.
    Thanks

    ReplyDelete
  3. A jar is just a zip file renamed with a different extension containing .class files.

    ReplyDelete