Learning Java/Deployment

Ok, there are different ways of deploying Java programs, but for right now I am going to add an easy one.

Jar Files edit

Jar files are basically .zip files but which basically contain all the class files and resource files for the program to work. So, it is possible to change a jar's file extension to .zip and unzip it to modify or view it's contents. There is also another important small file. It is the MANIFEST.MF file in the META-INF folder inside the jar file. This file is basically a text file so you can open it up with notepad or some text editor and change it. In the file it usually says "Manifest-Version:" and then the version number, which is 1.0 by default I think. To make your jar file execute when double-clicked, you must add on the line right below it "Main-Class:" and then the name of the class with the main method or the class file you want to execute when you double click the jar file. If it is in folders or packages you must reference it like com.google.talk where talk.class will be the class that will execute.

So, for example:

Main-Class: HelloWorld

This basically means that the HelloWorld class file in the top level of the jar file will be executed when double-clicked on. That's about it.

See Also edit