Menggali Informasi OS Menggunakan Java


Dalam contoh kali ini kita akan mempelajari, bagaimana menggali lebih banyak tentang sistem informasi di mana java berjalan. Contohnya adalah utnuk mengetahui nama Sistem Operasi yang digunakan, versi ke berapa, bagaimana arsitekturnya dll. Untuk mendapatkan informasi ini, digunakan command getProperty(String_katakunci). Berikut ini adalah daftar kata kunci yang digunakan untuk menggali informasi tentang OS:

S/No. 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 Thespecification 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 JREspecification name
14 java.class.version Java class format version number
15 ava.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

Berikut ini adalah contoh dari implementasi programnya:

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));
    }
}

About windupurnomo

I'm interested in programming. I am active with several programming such as Java, C #, C, JavaScript, HTML. I'm also develop desktop application (Java Swing), Mobile Application (Android), and Web programming (ASP MVC).
This entry was posted in Java and tagged , , , , , , . Bookmark the permalink.

2 Responses to Menggali Informasi OS Menggunakan Java

  1. uts3semester says:

    mantep mas tutorialnya maksih

  2. uts3semester says:

    oh ya mas kalau mengambil port di komputer kita punya codenya?? makasih

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s