解决httpclient在eclipse运行编码正常,ant编译打包后运行获取数据为乱码的问题(-Dfile.encoding)
在eclipse运行程序获取数据一切正常,但是当程序打包后运行获取数据出现乱码,通过查看windows进程发现有区别:
Eclipse运行的:
Caption=javaw.exe
CommandLine=C:\java\jre6\bin\javaw.exe -Dfile.encoding=UTF-8 -classpath D:\eclip
se3.6\eclipse\workspace\DCIClient……
打包后的:
Caption=java.exe
CommandLine="C:\java\jdk1.6.0_18\bin\java" "-Xmx512m" "-XX:MaxPermSize=256m" "-
Djava.library.path=libswt\win32" "-DKETTLE_HOME=" "-DKETTLE_REPOSITORY=" "-DKETT
LE_USER=" "-DKETTLE_PASSWORD=" "-DKETTLE_PLUGIN_PACKAGES=" "-DKETTLE_LOG_SIZE_LI
MIT=" -jar launcher\launcher.jar -lib ..\libswt\win32
加上-Dfile.encoding=UTF-8 就对了