执行某jar文件时,发现在只能在当前目录下,执行 java -jar "xxx.jar",如果在别的路径下执行 java -jar "d:\xxx\xxx.jar"时,就会报某某文件找不到的错误。于是写了个bat文件,加载环境变量
set classpath
=
%classpath%
;
d:\dist\config.properties;d:\dist\lib\commons-io-1.4.jar;d:\dist\lib\commons-logging-1.1.1.jar;d:\dist\lib\httpclient-4.0.3.jar;d:\dist\lib\httpcore-4.0.1.jar;d:\dist\lib\mysql-connector.jar
java -jar " d:\xxx\xxx.jar "
java -jar " d:\xxx\xxx.jar "