how to create .jar in mac code example Example 1: compile java to jar in mac javac HelloWorld.java Example 2: how to run jar file mac java -jar <filename>.jar