Java archive files are zipped files that contain classes plus other assets such as image files.
Create with the utility jar
which comes with the JDK. Eg, the command
jar cf mystuff.jar *.class *.png
would collect all classes and PNG images from the current directory and put them into file mystuff.jar.
We can then specify mystuff.jar on the classpath (instead of a directory path) and the JVM will find all classes inside it when it needs them.
JAR files are used widely as a means of distributing packages, classes, etc, including for uploading them to web servers (when they may be called WAR or EAR files - Web or Enterprise).
JAR files can be examined with WinZip. The jar
utility can in fact be used to make zip files: just give the JAR file the extension .zip.
To make Windows treat a .jar file like a .zip file, so you can explore it: in Windows Explorer, Tools/Folder options, File types tab: find JAR (by typing that) and click Delete button if it is there. Then use the New button, type JAR as the extension and from the Advanced button's long list select "Compressed (zipped) folder".
Main-Class: net.grelf.course.myapp.MyApp
[followed by essential blank line]
jar -cvfm myjar.jar mainclass.mf *.class *.other *.etc
java -jar myjar.jar
The batch file finds everything in the JAR, you don't set a classpath.