Creating a Local Jar
In order to test an application running in JAR format locally, I use a batch file that does the following:
1. Clears a work folder,
2. Creates the jars, (I have two batch files - "create all jars" and "create just the main application jar"
3. Copies the jars to the work folder,
4. Makes the main jar runnable.
5. Runs the main class.
An example is included below.
ECHO OFF
ECHO ********************************************
ECHO ToJarLoc.BAT - use ToJarFull.bat for making all jars
ECHO Objective - create a working set of Jars locally for testing
ECHO Do NOT update the zip files so that they will be pristine
ECHO when it is time to copy to the JAWS server
ECHO Steps
ECHO 1. clear the work folder l:\javadeliver of *.zip and *.jar files
ECHO 2. jar my main work file
ECHO 3. copy to work folder
ECHO 4. Run
ECHO ****************************************************
rem step 1
del l:\javadeliver\*.jar
dir l:\javadeliver\*.*
echo see what is in l:\javadeliver - should be DeliverIni.XML
pause
echo Creating Deliv.jar
del Deliv.jar
jar cvmf manifest.mf Deliv.jar *.class *.gif images\*.* src\DeliverPrc\*.class src\DeliverPrc\Images\*.* History.htm
echo Deliv.jar created
:2ndjar
rem - we copy all the jars when we are going to run locally
copy Deliv.jar l:\javadeliver
echo now do the 2nd set
echo creating tools.jar
jar cvf tools.jar org\jdom\*.* src\DeliverPrc\XML\*.* org\postgresql\*.* javax\*.* com\*.* *.xml
echo tools.jar created
:3rdjar
copy tools.jar l:\javadeliver
ECHO Note, the Help files is different, it is created by the help system.
ECHO so we just copy it
rem pause
:process
copy Deliverhelp.jar l:\javadeliver
copy Deliverhelp.jar l:\javadeliver\RMDeliverhelp.jar
if exist l:\javadeliver\deliv.jar echo making deliv.jar into runnable deliver.jar
if exist l:\javadeliver\deliv.jar java MakeJarRunnable Deliv.jar Deliver Deliver.jar
rem in the local version, everything goes to L:
copy Deliv.jar l:\javadeliver\Deliver.jar
rem pause
l:
cd \
cd javadeliver
java -jar Deliver.jar
f:
cd \
cd myjprojects\deliver
pause
:exit