赞
踩
java -jar JarName.jar
java -jar JarName.jar > jarName.log
nohup java -jar JarName.jar > jarName.log &
nohup java -jar JarName.jar > jarName.log &
或
nohup java -jar JarName.jar > jarName.log 2 > &1&
java -jar JarName.jar
java -jar JarName.jar > jarName.log
javaw -jar JarName.jar
创建.bat的文件,写入如下代码:
@echo off
start java -jar JarName.jar
exit
创建.bat文件,写入如下代码:
@echo off
%1 mshta vbscript:CreateObject("WScript.Shell").Run("%~s0 ::",0,FALSE)(window.close)&&exit
java -Dfile.encoding=utf-8 -jar JarName.jar > jarName.log 2>&1&
exit
-Dfile.encoding=utf-8 : 读取的配置文件里面包含中文了,此设置可以读取带中文的配置文件
@echo off
set port=14735
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do (
echo kill the process %%m who use the port
taskkill /pid %%m -t -f
goto start
)
:start
%1 mshta vbscript:CreateObject("WScript.Shell").Run("%~s0 ::",0,FALSE)(window.close)&&exit
java -Dfile.encoding=utf-8 -jar JarName.jar > jarName.log 2>&1&
exit
port : 与服务使用的端口一致
@echo off
set port=14735
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do (
echo kill the process %%m who use the port
taskkill /pid %%m -t -f
goto start
)
:start
%1 mshta vbscript:CreateObject("WScript.Shell").Run("%~s0 ::",0,FALSE)(window.close)&&exit
java -Dfile.encoding=utf-8 -jar JarName.jar > jarName.log 2>&1&
exit
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。