Saturday, November 7, 2009

How To Compile/Run Java Application Using Batch File

Steps to compile java application using batch file
Step1:
cd BIN
cd..
cd src
set PATH=C:\Program Files\Java\jdk1.5.0_06\bin;
set CLASSPATH=%CLASSPATH%;.;..\BIN\jre1.5.0_06\lib\rt.jar;..\BIN\jre1.5.0_06\lib\comm.jar;..\BIN\jre1.5.0_06\jce.jar;..\BIN\jre1.5.0_06\lib\jsse.jar;..\BIN\jars\jcommon-1.0.8.jar;..\BIN\jars\jfreechart-1.0.4.jar;..\BIN\jars\liquidlnf.jar;..\BIN\jars\openmap.jar;..\BIN\jars\skinlf.jar;..\BIN\jars\swingx-2006_10_27.jar;..\BIN\jars\comm.jar;..\BIN\jars\jhall.jar
CLS
@ECHO OFF
ECHO %CLASSPATH%
ECHO Compiling com\dtt\auth…
javac -d ..\bin\ com\dtt\auth\*.java
ECHO Compiling com\dtt\gps…
javac -d ..\bin\ com\dtt\gps\*.java
ECHO Compiling com\dtt\cpe…
javac -d ..\bin\ com\dtt\cpe\*.java
ECHO Compiling com\dtt\export…
javac -d ..\bin\ com\dtt\export\*.java
ECHO Compiling com\dtt\charts…
javac -d ..\bin\ com\dtt\charts\*.java
cd BIN
cd..
cd src
set PATH=C:\Program Files\Java\jdk1.5.0_06\bin;
set CLASSPATH=%CLASSPATH%;.;..\BIN\jre1.5.0_06\lib\rt.jar;..\BIN\jre1.5.0_06\lib\comm.jar;..\BIN\jre1.5.0_06\jce.jar;..\BIN\jre1.5.0_06\lib\jsse.jar;..\BIN\jars\jcommon-1.0.8.jar;..\BIN\jars\jfreechart-1.0.4.jar;..\BIN\jars\liquidlnf.jar;..\BIN\jars\openmap.jar;..\BIN\jars\skinlf.jar;..\BIN\jars\swingx-2006_10_27.jar;..\BIN\jars\comm.jar;..\BIN\jars\jhall.jar
CLS
@ECHO OFF
ECHO %CLASSPATH%
ECHO Compiling filepath…
javac -d ..\ filepath\*.java
Step2:
Steps to run java applications using batch file
@ECHO OFF
CLS
cd BIN
set path=..\BIN\jre1.5.0_06\bin
set CLASSPATH=.;..\BIN\jre1.5.0_06\lib\rt.jar;..\BIN\jars\comm.jar;..\BIN\jars\jcommon-1.0.8.jar;..\BIN\jars\jfreechart-1.0.4.jar;..\BIN\jars\liquidlnf.jar;..\BIN\jars\openmap.jar;..\BIN\jars\skinlf.jar;..\BIN\jars\swingx-2006_10_27.jar;..\BIN\jars\comm.jar;..\BIN\jars\jhall.jar
java MainClassfile

0 Comments:

Post a Comment

The Link Exchange - Your ultimate resource for link exchange!

About This Blog

  © Blogger template Webnolia by Ourblogtemplates.com 2009

Back to TOP