create a jar from java code code example
Example 1: compile jar file command
jar cvf example.jar *
Example 2: java to jar
# cd into the directory that contains your project
jar cvfe <output jar filename>.jar <main class location> *
jar cvf example.jar *
# cd into the directory that contains your project
jar cvfe <output jar filename>.jar <main class location> *