@echo off @rem invocation of a "mkjar filename" command : @rem 1) deletes the current temporary .java and .class @rem files in the "classes" subdirectory @rem 2) compiles the filename.pl source file and @rem 3) creates a filename.jar in subdirectory "classes" @rem 4) copies the classes\filename.jar to a destination @rem directory if you define environment variable "DESTDIR" @rem below and remove the corresponding rem's @rem This Win2000, WinNT script is only useful in case you @rem have several (or many) small single-file programs in 1 @rem directory with a common "classes" subdirectory and wants @rem to create a new jar file for a particular program. @rem Otherwise it's more useful to use "make" (Cygwin, Linux, @rem Solaris) or perhaps "nmake" (Windows) to define an @rem incremental compile, jar (and copy) command. if EXIST classes goto classes_dir_ok echo creating directory classes mkdir classes :classes_dir_ok for %%I IN (%1) DO set JARBASE=%%~nI @rem No del errorlevel exit code available: the @rem first time you execute mkjar, ingnore the @rem del "Could Not Find ...." error messages: del classes\*.java del classes\*.class call dlpc %JARBASE%.pl if ERRORLEVEL 1 goto cmp_error @rem Win2000, WinNT: JDKROOT is set by dlpc : cd classes %JDKROOT%\bin\jar cf %JARBASE%.jar *.class @rem jar doesnt return a valid exit code when for @rem instance the M option is not specified, but @rem this isnt very often a problem because dlpc.bat @rem will terminate correctly when an error occurred. @rem if ERRORLEVEL 1 goto jar_error cd .. @rem your copy command here, if necessary : if you @rem want to copy the jar file to another directory @rem (e.g. a WWW directory) define the destination @rem directory DESTDIR below and remove the 4 @rem's: @rem set DESTDIR=YOUR_DESTINATION_DIRECTORY_HERE @rem if NOT EXIST %DESTDIR% goto dest_error @rem copy /y classes\%JARBASE%.jar %DESTDIR%\%JARBASE%.jar @rem if ERRORLEVEL 1 goto copy_error @echo %0: done exit /b 0 @rem error summary: :cmp_error @echo %0: compilation errors, no new jar file created exit /b 1 :jar_error @echo %0: jar error, cannot create new jar file cd .. exit /b 1 :dest_error @echo %0: error, invalid destination directory: %DESTDIR% exit /b 1 :copy_error @echo %0: error, cannot copy jar file exit /b 1 :exit @echo %0: new %JARBASE%.jar file created exit /b 0