getsysprop.java

来自「java应用开发详解」· Java 代码 · 共 39 行

JAVA
39
字号
import java.security.*;class getSysProp{    public static void main(String[] args)     {        String s;        try         {            //默认返回字串为not specified            //得到系统名称            s = System.getProperty("os.name", "not specified");            System.out.println("  The name of your operating system is: " + s);       	    //得到java虚拟机版本号            s = System.getProperty("java.version", "not specified");            System.out.println("  The version of the JVM you are running is: " + s);	    //得到用户路径            s = System.getProperty("user.home", "not specified");            System.out.println("  Your user home directory is: " + s);	    //得到java_home            s = System.getProperty("java.home", "not specified");            System.out.println("  Your JRE installation directory is: " + s);	} 	catch (Exception e) 	{	    e.printStackTrace();        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?