First create a java program, compile it and test it.
Create a manifest file with the Main-Class: entry
Read the API doc for the syntax for the jar command.
And/Or do a Google on how to use the jar command.
Use the jar command to create the jar file.

you have to tell the jar-file about the main methode. First you make a txt-file and you write: Main-Class: YourMainClassName Remember to end the txt file with a emty line. Then you put the txt-file and all the class-files in the same directory. Finely you go by command line to that directory and do this: jar cfm my.jar my.txt *.class

The my.txt file content will be added to the jar-file manifest-file, and the file will be executable.