Creating a jar File in Eclipse

We are creating a sample java project to demonstrate how JAR files can be created in eclipse, by using standard menu options.

Step 1

Create a Sample Java Project, my project directory structure is as follows :

│   .classpath
│   .project
│       org.eclipse.jdt.core.prefs
│   └───myCustomLibrary
│           CustomCube.class
│           CustomSquare.class
    (Our first source file to calculate Cube)
    (Our second source file to calculate Square)

Code of both files are as under

package myCustomLibrary;

public class CustomCube {

	public int CustomCubeMethod(int number) {
		return number * number * number;

package myCustomLibrary;

public class CustomSquare {

	public int CustomSquareMethod(int number) {
		return number * number;

Step 2 (Exporting to JAR file, selecting export)


You may also like...