Presents your JAVA E-NEWSLETTER for April 17, 2003 <-------------------------------------------> TAKE ADVANTAGE OF RUNNABLE JARS Jar files make getting classes into the classpath easy and can also make your application easier to run. Runnable jars have been around since Java 1.2, but many developers don't take advantage of them. A runnable jar is a jar that you can execute with a command such as: java -jar application.jar The -jar tells the virtual machine to look at the jar's manifest file to find the class name that is the starting point of the application. You indicate the class where execution should begin by including a Main-Class entry in the jar's manifest file: Main-Class: com.somecompany.someapp.MainClass To include your own manifest file while creating a jar, use the jar tool's -m switch: jar cmf manifest runnable.jar . For example, runnable jars can turn this: java -cp application.jar com.somecompany.someapp.MainClass into this: java -jar application.jar Not only is that less typing, but it's also less to remember. However, if your application runs inside of a container or you have a lot of other jars you need to put in your classpath, then a runnable jar might not be the best fit for your environment. ----------------------------------------