http://baobeituping.iteye.com/blog/802543
1.
Java Engineering Path Structure
Project
------Lib
------SRC
------Webroot
----Web-inf
-----Classes
Two files:
Run.bat
SetEnv.bat
Run.bat:
@echo off
Set path=.; C:\Program files\java\jdk1.6.0_02\bin--Set the path to Java
Set cp=
For%%i in ("Lib\*.jar") does call SetEnv.bat%%i--loop to load the package under the project Lib
Set classpath=%cp%;.;. \webroot\web-inf\classes;--set classes, load all classes under the project
Java client. client--Loading Main Program Files
2.Xxx.bat@echo off
Java-dlog.dir=f:/log/userdistributionanalysis-dconf.env=test-xms384m-xmx384m-dfile.encoding=gbk-classpath.;.. /webroot/web-inf/lib/*, .... /webroot/web-inf/classes Com.linktong.core.context.Daemon daemon_tsinauserdeal.properties
Create a BAT file with the following format (specific content needs to be modified according to your situation): The first two lines are DOS commands for entering the folder where your class file is located (assuming in c:\myjava\) the path is the JDK. The bin folder Classpath that line is the folder or jar file for the other helper classes that you need to run your Java class. XXX is the full running path to your Java class (if you need to add the package, such as the Java tool, in the package). Mytool,tool for package) C:CD C:\myjava\set path=c:\j2sdk1_4_2_08\bin;set classpath=.; C:\j2sdk1_4_2_08\lib\tools.jar;java xxx
3. How to write a batch file to execute it, the parameter in test () is passed in the batch file and prints out its two parameters. Run.bat @echo off
Set current_dir=%cd%
F:
CD Test
Javac Test.java
Java Test%cd% 3
Pause The CD is stored in the current path , put this run.bat in the project directory, the CD to get the project path , the above%cd% meaning is only the same parameter value 31 kind. If there are spaces in my current directory path, such as C:\Documents and settings\administrator\ desktop \project, there is a space between the strings in DOS to represent the different variables, so the C \ Documentsand, how do I filter the spaces in the path?
In DOS, if you include the name of a space, add "".
Write batch commands to execute Java files