标签:wing .com 目录结构 文件中 star func 完成后 jar包 serve
一、 下载Javaservice ,把压缩文件解压,放到本地磁盘。rem Get the current path
set C_PATH=%CD%
rem Get the installation path
set /p "I_PATH=Please enter the installation path:"
rem Check whether the installation path exists.
rem If the path already exists ,exit.
rem if no exists,creation installation path.
if exist %I_PATH% goto I_PATH_EXIT
if not exist %I_PATH% goto I_PATH_ONT_EXIT
:I_PATH_EXIT
echo %I_PATH% Already exist, please replace
set /p "I_PATH=Please enter the installation path:"
if exist %I_PATH% goto I_PATH_EXIT
if not exist %I_PATH% goto I_PATH_ONT_EXIT
:I_PATH_ONT_EXIT
mkdir %I_PATH%\app
rem echo Copy the file to the installation directory
rem xcopy directory ,copy file
xcopy %C_PATH%\app %I_PATH%\app /s
@ timeout 3
rem Register as a service
%I_PATH%\app\JavaService.exe -install Hello-test "%I_PATH%\app\java-1.8.0_172\jre\bin\server\jvm.dll" -Xms256m -Xmx1024m -jar -Djava.class.path="%I_PATH%\app\java-1.8.0_172\lib\tools.jar;%I_PATH%\app\helloworld.jar" -start "org.springframework.boot.loader.JarLauncher" -out "%I_PATH%\app\out.log" -err "%I_PATH%\app\err.log" -current "%C_PATH%" -auto
@ timeout 5
net start Hello-test
rem Generate configuration file
echo 系统安装路径:%I_PATH%\app > %C_PATH%\confing.txt
echo 系统启动命令:net start Hello-test >> %C_PATH%\confing.txt
echo 系统关闭命令:net stop Hello-test >> %C_PATH%\confing.txt
echo 可以通过服务启动或关闭系统(已经配置开机自启动 )>> %C_PATH%\confing.txt
echo 系统服务卸载命令:sc delete Hello-test >> %C_PATH%\confing.txt
pause
注:-start "org.springframework.boot.loader.JarLauncher" –start 后面的class 为第二步中查到的class名称
六、 在Windows 10操作系统上进行测试(双击start.bat文件)
看到上面的页面,说明服务注册成功,并已经启动,按任意键退出即可。
七、 查看管理说明文档
confing.txt 在成功启动服务后自动生成
八、 查看安装路径文件
其中out.log 文件中记录服务启动日志
九、 参考文档
https://blog.csdn.net/cxj1990year/article/details/41862831
通过JavaService 将java jar包注册成Windows 服务
标签:wing .com 目录结构 文件中 star func 完成后 jar包 serve
原文地址:http://blog.51cto.com/lrtao2010/2153450