Software >> Development >> Languages >> Java >> How to use .jar file to execute a project with multiple class files

1. compile all your .java files 2. identify which class holds your main() eg. XYZ.class 3. create a manifest file (eg. named manifest with no extensions) with a line specifying this class that holds main. Put a carriage return at the end manifest -------- Main-Class: XYZ 4. create the jar file run.jar specifying the manifest file and the class files to add to the jar > java -jar cmf manifest run.jar *.class 5. to run > java -jar run.jar