linux環境下,java程式手工執行不亂碼,crontab自動執行就亂碼,解決方案!

okone96發表於2007-06-18

假設您要執行.sh檔案:

在.sh檔案里加入
LANG=en_US.iso885915
NLS_LANG='simplified chinese'
export LANG
export NLS_LANG

解決方案2:臺灣某人解決方案,我測試透過.

/usr/local/jdk1.4.2/bin/java -Dfile.encoding=GBK(關鍵就是最後一行)

例子:

/opt/jdk1.5/bin/java -Dfile.encoding=UTF-8 -Xmx512m -cp /opt/baofeng_paihangbang/program/lib/commons-email-1.0.jar:/opt/baofeng_paihangbang/program/lib/activation.jar:/opt/baofeng_paihangbang/program/lib/ant.jar:/opt/baofeng_paihangbang/program/lib/commons-codec-1.3.jar:/opt/baofeng_paihangbang/program/lib/commons-collections-3.1.jar:/opt/baofeng_paihangbang/program/lib/commons-configuration-1.1.jar:/opt/baofeng_paihangbang/program/lib/commons-dbcp-1.2.1.jar:/opt/baofeng_paihangbang/program/lib/commons-httpclient-3.1-alpha1.jar:/opt/baofeng_paihangbang/program/lib/commons-io.jar:/opt/baofeng_paihangbang/program/lib/commons-lang-2.1.jar:/opt/baofeng_paihangbang/program/lib/commons-logging.jar:/opt/baofeng_paihangbang/program/lib/commons-pool-1.2.jar:/opt/baofeng_paihangbang/program/lib/dom4j.jar:/opt/baofeng_paihangbang/program/lib/dom.jar:/opt/baofeng_paihangbang/program/lib/jaxen-core.jar:/opt/baofeng_paihangbang/program/lib/jaxen-jdom.jar:/opt/baofeng_paihangbang/program/lib/jdom.jar:/opt/baofeng_paihangbang/program/lib/log4j.jar:/opt/baofeng_paihangbang/program/lib/mysql-connector-java-3.0.9-stable-bin.jar:/opt/baofeng_paihangbang/program/lib/saxpath.jar:/opt/baofeng_paihangbang/program/ com/community/AnalysisTop/DataAnalysisTopMain;

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/750220/viewspace-919181/,如需轉載,請註明出處,否則將追究法律責任。

相關文章