System中的getProperties方法使用
来源:互联网 发布:windows ce iso 编辑:程序博客网 时间:2024/05/16 14:48
1.我们可以使用System中提供的方法获取系统,用户的参数
public class OS {
public static void main(String args[]){
String OsName=System.getProperty("os.name");//操作系统名称
String OsArch=System.getProperty("os.arch");//操作系统的构架
String OsVersion=System.getProperty("os.version");//操作系统版本
String JavaVendorUrl=System.getProperty("java.vendor.url");//供应商url
String UserName=System.getProperty("user.name");
System.out.println("操作系统的名称:"+OsName);
System.out.println("操作系统构架:"+OsArch);
System.out.println("操作系统版本:"+OsVersion);
System.out.println("供应商 url:"+JavaVendorUrl);
System.out.println("用户名:"+UserName);
}
}
2.
public static Properties getProperties()
First, if there is a security manager, its checkPropertiesAccess
method is called with no arguments. This may result in a security exception.
The current set of system properties for use by the getProperty(String)
method is returned as a Properties
object. If there is no current set of system properties, a set of system properties is first created and initialized. This set of system properties always includes values for the following keys:
java.version
Java Runtime Environment versionjava.vendor
Java Runtime Environment vendorjava.vendor.url
Java vendor URLjava.home
Java installation directoryjava.vm.specification.version
Java Virtual Machine specification versionjava.vm.specification.vendor
Java Virtual Machine specification vendorjava.vm.specification.name
Java Virtual Machine specification namejava.vm.version
Java Virtual Machine implementation versionjava.vm.vendor
Java Virtual Machine implementation vendorjava.vm.name
Java Virtual Machine implementation namejava.specification.version
Java Runtime Environment specification versionjava.specification.vendor
Java Runtime Environment specification vendorjava.specification.name
Java Runtime Environment specification namejava.class.version
Java class format version numberjava.class.path
Java class pathjava.library.path
List of paths to search when loading librariesjava.io.tmpdir
Default temp file pathjava.compiler
Name of JIT compiler to usejava.ext.dirs
Path of extension directory or directoriesos.name
Operating system nameos.arch
Operating system architectureos.version
Operating system versionfile.separator
File separator ("/" on UNIX)path.separator
Path separator (":" on UNIX)line.separator
Line separator ("\n" on UNIX)user.name
User's account nameuser.home
User's home directoryuser.dir
User's current working directoryMultiple paths in a system property value are separated by the path separator character of the platform.
Note that even if the security manager does not permit the getProperties
operation, it may choose to permit thegetProperty(String)
operation.
- Returns:
- the system properties
- Throws:
SecurityException
- if a security manager exists and itscheckPropertiesAccess
method doesn't allow access to the system properties.- See Also:
setProperties(java.util.Properties)
,SecurityException
,SecurityManager.checkPropertiesAccess()
,Properties
- System中的getProperties方法使用
- System.getProperties中的所有属性
- System.getProperties()
- System.getProperties()(
- System.getProperties();
- System.getProperties
- System.getProperties("?")
- System.getProperties()
- System.getProperties().
- System.getProperties()方法获取的…
- System.getProperties参数列表
- System.getproperties()所有参数
- System.getProperties使用方法
- System.getProperties()~~~转
- System.getProperties大全
- 【JAVA】System.getProperties()
- JBOSSWEB System.getProperties();
- System.getProperties()和System.getProperty()
- bat 读写文件中对感叹号“!”的处理
- 第一
- OWASP Top 10 – 2013, 最新十大安全隐患(ASP.NET解决方法)
- 第16周项目1数组的排序
- Android高手速成--第二部分 工具库
- System中的getProperties方法使用
- 文件上传
- C++ this指针详解
- zsh与bash设置环境变量的不同点
- 如何利用FastReport创建交叉报表?
- java上传 压缩包文件
- 【python】python中的条件判断和循环
- Activity四种LaunchMode透彻理解
- linux tar 命令