java获得系统信息
import ? java.util.*; ?
? public ? class ? listsystem{ ?
? ?
? public ? static ? void ? main(String ? args[]){ ?
? ?
? Properties ? prop ? = ? System.getProperties(); ?
? ?
? // ? 获取用户名 ?
? System.out.println("\n当前用户名:"+prop.getProperty("user.name")); ?
? ?
? // ? 获取操作系统 ?
? System.out.println("\n当前系统:"+prop.getProperty("os.name")); ?
? ?
? // ? 获取所有信息 ?
? //System.getProperties().list(System.out); ?
? ?
? } ?
? }