I have a java application develeped in netbeans. I want to create a batchfile that recompiles the project and packs the resulting jar files along with some documentation to a zip file and generate an installer.
The packing and generation of the installer is no problem, but I dont know how to automate the compilation from commandline/batchfile - whenever I change something in the source-code I have to manually click on "Clean and Build" inside netbeans and run my batchfile afterwards.
What do I have to add to the batchfile to do the same as "Clean and Build" from inside netbeans?
I found out myself what to do:
- Make sure ant is in your path (e.g. I added C:\Programme\NetBeans 6.9.1\java\ant\bin to my PATH environment)
- Make sure your JAVA_HOME is set correctly
- execute "ant clean" and "ant jar" in the directory of your netbeans project
The batchfile I use:
SET JAVA_HOME=C:\Programme\Java\jdk1.6.0_12
call ant deps-clean
call ant clean
call ant jar
pause
cp -r doc dist
cp -r scripts dist
cp -r examples dist
cp -r crypt dist
cp -r db dist
cp -r license dist
rm dist/README.TXT
cp README.TXT dist
echo package creation %date:~-4,4%_%date:~-7,2%_%date:~0,2% >> dist/README.TXT
cd win_service
RCEDIT.exe /C wizard.exe
RCEDIT.exe /I wizard.exe my_app.ico
RCEDIT.exe /N wizard.exe pre_wizard.ini
RCEDIT.exe /C my_app_service.exe
RCEDIT.exe /I my_app_service.exe my_app.ico
RCEDIT.exe /N my_app_service.exe pre_my_app_service.ini
cp my_app_service.ini ../dist
cp my_app_service.exe ../dist
cp wizard.exe ../dist
cp wizard.ini ../dist
cp service*.bat ../dist
cp *.nsi ../dist
cp *.nsh ../dist
cp my_app.log ../dist
cd ..
cd dist
mkdir windows
cp *.jar windows
cp -r lib windows
cp -r crypt windows
cp -r db windows
cp examples\empty_settings.ini windows\settings_example.ini
mv *.exe windows
mv *.ini windows
mv *.bat windows
mv *.nsi windows
mv *.nsh windows
mv my_app.log windows
cd windows
my_app.nsi
mv my_appInstaller.exe ../my_appInstaller_gpl.exe
rm lib\jdbc-mysql.jar
my_app.nsi
mv my_appInstaller.exe ../my_appInstaller.exe
cd ..
rm -rf my_app
mkdir my_app
mv *.jar my_app
mv lib my_app
mv crypt my_app
mv db my_app
mv examples\empty_settings.ini my_app\settings.ini
ren my_app 9880
mkdir my_app
mv 9880 my_app
7z a -r -tzip my_app_gpl.zip doc license examples scripts my_app README.txt my_appInstaller_gpl.exe
rm my_app\9880\lib\jdbc-mysql.jar
7z a -r -tzip my_app.zip doc license examples scripts my_app README.txt my_appInstaller.exe
cd ..
pause
"Error running javac.exe compiler" Looks if the JDK was not in the PATH.