java compiler for jar file code example
Example 1: java to jar
# cd into the directory that contains your project
jar cvfe <output jar filename>.jar <main class location> *
Example 2: compile java to jar in mac
javac HelloWorld.java
# cd into the directory that contains your project
jar cvfe <output jar filename>.jar <main class location> *
javac HelloWorld.java