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 :

D:.
│   .classpath
│   .project
│
├───.settings
│       org.eclipse.jdt.core.prefs
│
├───bin
│   └───myCustomLibrary
│           CustomCube.class
│           CustomSquare.class
│
└───src
    └───myCustomLibrary
            CustomCube.java  (Our first source file to calculate Cube)
            CustomSquare.java  (Our second source file to calculate Square)

Code of both files are as under

CustomCube.java

package myCustomLibrary;

public class CustomCube {

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

CustomSquare.java

package myCustomLibrary;

public class CustomSquare {

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

Step 2 (Exporting to JAR file, selecting export)