解決CentOS中JDK7中文驗證碼亂碼問題

2021-07-25 00:23:06 字數 808 閱讀 6502

redhed 沒出現亂碼 本身就jdk就支援中文,centos中的jdk不支援中文

亂碼如下:

第一種方法:(可能不通用)

1.從windows  c:\windows\fonts裡拿取simsun.ttc(宋體)。

注:根據自己在awt中使用的字型,自主選擇

2.放到linux /usr/share/fonts/truetype中 在用fc-cache -f -v 讓系統知道這個字型。

3.linux中跳轉到jdk安裝目錄 ..../jre/lib/fonts

4.sudo mkdir fallback

cd fallback

sudo ln -s /usr/share/fonts/truetype/simsun.ttc

sudo mkfontdir

sudo mkfontscale

1.從windows c:\windows\fonts裡拿取simsun.ttc(宋體)。

2.linux中跳轉到jdk安裝目錄 ..../jre/lib/fonts

3.輸入命令:sudo mkdir fallback  然後將windows所拷貝的字型放到fallback中

4.重啟環境變數  使其生效:source /etc/profile

tomcat重啟,ok沒問題,完美解決

JDK6和JDK7中的substring 方法

substring int beginindex,int endindex 方法在jdk6和jdk7中是不同的。明白它們之間的差別可以幫助我們更好的使用這個方法。為了簡單起見,下面使用substring 代替substring int beginindex,int endindex substrin...

解決Centos7中文顯示亂碼

一 首先檢視當前系統預設採用的字符集 命令 locale 或者echo lang,如果當初安裝的時候已經選擇了中文語言包的話,那麼預設的就是utf 8字符集 root localhost locale lang zh cn.utf 8 lc ctype zh cn.utf 8 lc numeric ...

JDK7中HashMap的解析(未完)

1 hashmap採用的是資料 鍊錶的儲存結構 2 初始化預設長度為16,每次擴容 2,負載因子預設0.75 3 擴容核心類 void transfer entry newtable,boolean rehash int i indexfor e.hash,newcapacity e.next ne...