http://www.javaworld.com/javaworld/jw-07-1998/jw-07-jar.html
| ||
This isn't the most high-tech way to do things, but I thought I'd share these Windows (DOS) shell scripts that I'm currently using to compile a Java application, create a Jar file to distribute the application, and finally run the application. I ended up creating these scripts because of configuration problems on my Windows PC, but I thought they might be useful samples for others. As you'll see the mostly correct problems with my Here's the first script I named set JAVA_HOME=C:/jdk1.5.0_06 set PATH=C:/Windows;C:/Windows/System32;C:/jdk1.5.0_06/bin set CLASSPATH= javac -cp ".;forms-1.0.7.jar" com/devdaily/xylocator/XYLocator.java Here's the second script I named set JAVA_HOME=C:/jdk1.5.0_06 set PATH=C:/Windows;C:/Windows/System32;C:/jdk1.5.0_06/bin set CLASSPATH= jar cfm xylocator.jar Manifest.txt com/devdaily/xylocator/*.class That command also requires a file named Main-Class: com.devdaily.xylocator.XYLocator Class-Path: forms-1.0.7.jar The first line in the manifest file tells the JVM where to find the That script creates a jar file (with the manifest included) so I can just use the set JAVA_HOME=C:/jdk1.5.0_06 set PATH=C:/jdk1.5.0_06/bin;C:/Windows;C:/Windows/System32 set CLASSPATH= java -jar xylocator.jar FWIW, I'm actually very lazy, as you can tell from the file names I've shown. I use the 1, 2, and 3 as filename prefixes to remind me the order things should be run in later. That's pretty lazy. :) |