/**
* 测试Properties
*/
package com.you.model;
import java.util.Properties;
/**
* @author Administrator
* 测试出系统的软件配置环境和系统编码格式
*/
public class PropertyEncoding
{
/**
* @param args
*/
public static void main(String[] args)
{
/**
* 系统详细配置
*/
Properties properties = System.getProperties();
/**
* 系统编码格式
*/
String encoding = properties.getProperty("file.encoding");
/**
* 设置系统编码格式
*/
String systemStr = properties.getProperty(encoding, "UTF-8");
//打印系统详细配置
System.out.println("系统详细配置:" + properties);
//打印系统编码格式
System.out.println("系统编码格式:" + encoding);
//打印设置系统编码格式
System.out.println("设置系统编码格式:" + systemStr);
}
}
系统详细配置:{java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:Program FilesJavajdk1.7.0_05jrein, java.vm.version=23.1-b03, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=CN, user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=Service Pack 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:eclipseworkspaceFusionChart, java.runtime.version=1.7.0_05-b05,, java.version=1.7.0_05, java.ext.dirs=C:Program FilesJavajdk1.7.0_05jrelibext;C:WindowsSunJavalibext, sun.boot.class.path=C:Program FilesJavajdk1.7.0_05jrelib
esources.jar;C:Program FilesJavajdk1.7.0_05jrelib
t.jar;C:Program FilesJavajdk1.7.0_05jrelibsunrsasign.jar;C:Program FilesJavajdk1.7.0_05jrelibjsse.jar;C:Program FilesJavajdk1.7.0_05jrelibjce.jar;C:Program FilesJavajdk1.7.0_05jrelibcharsets.jar;C:Program FilesJavajdk1.7.0_05jrelibjfr.jar;C:Program FilesJavajdk1.7.0_05jreclasses, java.vendor=Oracle Corporation, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=}
系统编码格式:GBK
设置系统编码格式:UTF-8