create a file named "MANIFEST.MF"
write the following content in it:
Main-Class: packagename.mainclassname
the mainclassname is the class contain main(...),eg test.Test
use jar command to create a jar file:
jar cfm test.jar MANIFEST.MF test
test is the folder containing class files,you can specify more than one folder,
jar cfm test.jar MANIFEST.MF test1 test2 test3
for more detail please read help information of "jar" command.