在 .bash_profile 文件中,增加如下行:
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
然后,重新加载该配置
source .bash_profile
问题解决。
附:整个 Java 配置
alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' export GOROOT=/usr/local/go export GOPATH=/Users/wenjianbao/GoLandProjects export PHP=/usr/local/php/php-5.6 export PATH=$GOROOT/bin:${GOPATH//://bin:}/bin:$PHP/bin:$PHP/sbin:/usr/local/nginx/sbin:/usr/local/mysql:/usr/local/Cellar/subversion/1.9.4/b in:$PATH JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar MAVEN_HOME=/alidata/server/maven TOMCAT_HOME=/alidata/server/tomcat PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$TOMCAT_HOME/bin:$PATH: export JAVA_HOME export CLASSPATH export PATH export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8