bboks.net™

Java 시스템 정보 가져오기 본문

Java/Java

Java 시스템 정보 가져오기

bboks.net 2011. 1. 19. 15:00

Java에서 현재 시스템의 정보를 가져오기 위해서는 System 클래스의 getPoperty(String key) 메소드를 이용하면 된다.

                        Key                                       Description
  1   java.version   The version of Java Runtime Environment.
  2   java.vendor    The name of Java Runtime Environment vendor
  3   java.vendor.url   The URL of Java vendor
  4   java.home   The directory of Java installation 
  5   java.vm.specification.version   The specification version of Java Virtual Machine
  6   java.vm.specification.vendor   The name of specification vendor of Java Virtual Machine 
  7   java.vm.specification.name   Java Virtual Machine specification name
  8   java.vm.version    JVM implementation version
  9   java.vm.vendor   JVM implementation vendor
  10   java.vm.name    JVM  implementation name
  11   java.specification.version    The name of specification version Java Runtime Environment 
  12   java.specification.vendor   JRE specification vendor
  13   java.specification.name    JRE specification name
  14   java.class.version   Java class format version number
  15   java.class.path   Path of java class
  16   java.library.path   List of paths to search when loading libraries
  17   java.io.tmpdir   The path of temp file
  18   java.compiler   The Name of JIT compiler to use
  19   java.ext.dirs   The path of extension directory or directories
  20   os.name    The name of OS name
  21   os.arch    The OS architecture
  22   os.version    The version of OS
  23   file.separator   The File separator
  24   path.separator    The path separator 
  25   line.separator   The line separator
  26   user.name   The name of account name user
  27   user.home   The home directory of user 
  28   user.dir    The current working directory of the user


예제
public class OpertingSystemInfo {
	public static void main(String[] args) {
		String nameOS = "os.name";
		String versionOS = "os.version";
		String architectureOS = "os.arch";
		System.out.println("\n    The information about OS");
		System.out.println("\nName of the OS: " + System.getProperty(nameOS));
		System.out.println("Version of the OS: "
				+ System.getProperty(versionOS));
		System.out.println("Architecture of THe OS: "
				+ System.getProperty(architectureOS));
	}
}


[출처] Operating System Information