AUGUSTEN TECHNICAL

FRESHERS SHINE

Pages

Thursday, 17 July 2014

How to Make Executable JAR file in Eclipse IDE - Java

If you are Java programmer then you know what is purpose of JAR file, but for those who are unaware, JAR file is deliverables of Java application. Just like C and C++ application produce EXE files, Java produce JAR files. In other words, A JAR (Java Archive) file is a ZIP format file that bundles Java classes into a single unit, it may contain all the resource needed by Java application as well. There are mainly two types of JAR file in Java: Library JAR (normal JAR) files: JARs which are reusable libraries e.g. Apache commons JAR file, guava.jar itself or even JDBC drivers  e.g. ojdbc6_g.jar. There is another type as well, Executable JAR files: JARs which can be executed as a standalone Java applications. Main difference between normal and executable JAR file is that later contains mainfest file, which specify a main-class entry. When you run that JAR file, Java start your application by reading that main-class entry, because you need main method to execute Java programs. I had earlier shared steps to create JAR file from command prompt, which if you have not read, go read it. You will learn about basics of JAR command, which comes with JDK, mainfest file and different attributes of manifest file. In this tutorial we will learn how to make/create/export both library and executable JAR file in Eclipse IDE. Why it's important to know creating executable JAR in Eclipse, because its one of the most used tool by Java programmer. Once you know the steps, you export your Java program as JAR file in a second or two. After creating executable JAR file, you can follow these steps to run Java program from JAR file in command line.

0 comments:

Post a Comment