tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Commons Lang3 > General > System Util

System Util 

Apache Commons Lang 3.0 is a java library with lot of utilities and reusable components. This requires the library commons-lang3-3.0.1.jar to be in classpath. The following example shows accessing various system and its derived properties from SystemUtils.

File Name  :  
com/bethecoder/tutorials/commons_lang/tests/gen/SystemUtilTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.commons_lang.tests.gen;

import org.apache.commons.lang3.SystemUtils;

public class SystemUtilTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(SystemUtils.JAVA_VERSION);
    System.out.println(SystemUtils.OS_NAME);
    System.out.println(SystemUtils.JAVA_HOME);
    System.out.println(SystemUtils.IS_OS_WINDOWS);
    System.out.println(SystemUtils.IS_OS_WINDOWS_XP);
    System.out.println(SystemUtils.IS_OS_WINDOWS_VISTA);
  }

}
   

It gives the following output,
1.6.0_10
Windows XP
C:\Program Files\Java\jdk1.6.0_10\jre
true
true
false



 
  


  
bl  br