Linux下crontab自动运行Java程序乱码解决方案
时间:2007-12-06 来源:qbq
假设您要运行.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;