Executable jar files

Suppose you have your two files Sales.java and Main.java.

You can go ahead and compile them so that you have Sales.class and Main.class

Now make a new file named manifest.txt

in it, have one line

Make sure that this is the first line (no blank line) in the file and that you hit the carriage return afterwards.

Main-Class: Main

You are specifying this since Main is the name of your class that will be in your .jar that has the main method in it.
If it were in a package, it would be myPackage.Main (if you do this you can save the whole directory of myPackage with all of the stuff in it)

Save the manifest.txt file

Now, you can make the jar, by going to the command window and going to the directory that the files are all in

At the command line say:
jar cmf manifest.txt lab6.jar Sales.class Sales.java Main.class Main.java

this will make a jar file named lab6.jar that *should* be an executable from the desktop (double-click to start)

If this does not work, you can go to the command line and give the command
java –jar lab6.jar