build java into a jar file command code example
Example 1: create a JAR file containing the class file
jar cvf jar_name.jar class_you_want_in_jar.class
Example 2: compile java to jar in mac
javac HelloWorld.java
jar cvf jar_name.jar class_you_want_in_jar.class
javac HelloWorld.java