Java獲取Linux服務器系統默認編碼格式


一:查找java進程

ps -ef | grep java

二:使用jinfo命令查看java系統參數

jinfo -sysprops 進程id
Usage:
jinfo [option] <pid>
(to connect to running process)
jinfo [option] <executable <core>
(to connect to a core file)
jinfo [option] [server_id@]<remote server IP or hostname>
(to connect to remote debug server)

where <option> is one of:
-flag <name> to print the value of the named VM flag
-flag [+|-]<name> to enable or disable the named VM flag
-flag <name>=<value> to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
<no option> to print both of the above
-h | -help to print this help message

最后三行

java.vm.name = Java HotSpot(TM) Client VM
file.encoding = UTF-8
java.specification.version = 1.8

 

 

也可以使用locale命令查看

[www@iZwz9ikd8ja49b7v8dhqihZ ~]$ locale

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

如果想修改系統編碼:

修改/etc/sysconfig/i18n,如改成中文編碼:

LANG=en_US.UTF-8

改為

LANG="zh_CN.GBK"

然后在不重啟的情況下重新加載i18n文件

root@ubuntu:/etc# source /etc/sysconfig/i18n
參考https://www.cnblogs.com/xxiong1031/articles/6884457.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM