Jesus 'n Jim
A PC and somewhat Mac oriented site with Software and Repair Info and How-To's on Using Computers

batch file to create java jar

 

batch file to create java jar

rem I usually use a batch file like this to build a jar from the :
if "%version%"=="" goto end
mkdir src
del *.jar
del *.class
del /q src\*.java
copy /y *.java src
javac -target 1.5 *.java
jar cvfe Hyper3.jar Hyper3 *.class *.java src\*.java
rem make copy of jar file into distribution directory (optional)
copy /y *.jar ..
del ..\*.zip
rem use 7-zip's command line tool to zip-archive the directory (7-zip.org)
rem version 907 will remove the need for -tzip apparently
7z a -tzip ..\Hyper3-4D-%version%.zip *.java *.jar CHANGELOG LICENSE README *.txt *.doc *.4d *.bat *.cmd *.dtd
:end
rem set version=3.15
echo. make sure you do a SET version=1.1 before you start the batch file.

javac -target 1.5 *.java
the -target compiler switch let you specify what JRE runtime version is required for the program to run. you might want to set yours to 1.5 so that people who have windows 9x can run your programs.

you might also consider that newer features (possibly Swing) won't work in windows 9x/me (JRE 1.5.0_9 maximum I think).

Yes, there are still windows 9x/me machines out there - I have customers who have those machines. people give them to their kids, too.