首页 > 代码库 > java中的System.getProperty()和getenv()方法
java中的System.getProperty()和getenv()方法
Java system.getproperty(String name)获取系统属性
属性说明:
public class test{ public static void main(String[] args) { System.out.println("Java Runtime Environment version = " + System.getProperty("java.version")); System.out.println("Java Runtime Environment vendor = " + System.getProperty("java.vendor")); System.out.println("Java vendor URL = " + System.getProperty("java.vendor.url")); System.out.println("Java installation directory = " + System.getProperty("java.home")); System.out.println("Java Virtual Machine specification version = " + System.getProperty("java.vm.specification.version")); System.out.println("Java Runtime Environment specification version = " + System.getProperty("java.specification.version")); System.out.println("Java class format version number = " + System.getProperty("java.class.version")); System.out.println("Java class path = " + System.getProperty("java.class.path")); System.out.println("Operating system name = " + System.getProperty("os.name")); System.out.println("Operating system architecture = " + System.getProperty("os.arch")); System.out.println("File separator (‘/‘ on UNIX) = " + System.getProperty("file.separator")); System.out.println("User‘s account name = " + System.getProperty("user.name")); System.out.println("User‘s home directory = " + System.getProperty("user.home")); System.out.println("User‘s current working directory = " + System.getProperty("user.dir"));}
Java system.getenv(String name)获取环境变量
System.out.println(System.getenv("Java_Home"));
java中的System.getProperty()和getenv()方法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。