JAVA 매일 한 문제 16

1279 단어 자바jvmSecurityOS
제목:접근 권한 을 제어 하 는 예 를 JAVA 로 만 듭 니 다.
   
package test;
import java.lang.*;
import java.security.*;
class GetProps
{
	public static void main(String[] args)
	{
		String s;
		try
		{
			System.out.println("About to get os.name property value");
			//      
			s = System.getProperty("os.name", "not specified");
			System.out.println(
"The name of your operating system is: "+s);
			System.out.println(
"About to get java.version property value");
			//  JVM  
			s = System.getProperty("java.version", "not specified");
			System.out.println(
				"  The version of the JVM you are running is: " + s);
			System.out.println("About to get user.home property value");
			//        
			s = System.getProperty("user.home", "not specified");
			System.out.println("Your user home directory is: " + s);
			System.out.println("About to get java.home property value");
			//  JVM    
			s = System.getProperty("java.home", "not specified");
			System.out.println("Your JRE installation directory is: "+s);
		}
		catch (Exception e)
		{
			System.err.println("Caught exception " + e.toString());
		}
	}
}

좋은 웹페이지 즐겨찾기