System.getProperty()和getenv()

System.getproperty(String name) 获取系统属性

System.getProperties() 获取所有系统属性

System.getenv(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"));
}    
System.out.println(System.getenv("Java_Home"));
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值