java工程使用UTF-8编码,windows下java启动脚本,所有设置使用UTF-8编码,cmd窗口输出,日志输出等都不会乱码
@echo off
setlocal enabledelayedexpansion
rem @chcp 936
@title SspJobServer
echo SspJobServer
rem use utf-8
chcp 65001
rem mode con cols=100
color 9
set JAVA_TOOL_OPTIONS=-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8
echo 启动任务
set APP_HOME=%~dp0
set APP=%APP_HOME%target\youProject.jar
echo ---------------------------------------
echo starting SspJobServer at 8084
echo using JAVA_HOME: %JAVA_HOME%
echo using APP_HOME: %APP_HOME%
echo using APP: %APP%
echo -------------------------------------
rem mvn -Dmaven.test.skip=true clean package
md %APP_HOME%temp 2>NUL
md %APP_HOME%logs 2>NUL
set JVM_PARAM= -Djava.io.tmpdir=%APP_HOME%temp -DlogDir=%APP_HOME%logs
java %JVM_PARAM% -jar %APP%
@pause