Skip to Content

Get system properties using System class

  • strict warning: Non-static method view::load() should not be called statically in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_argument.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter_boolean_operator.inc on line 0.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_style_default.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_row.inc on line 0.

  1. /*
  2.         Get system properties using System class
  3.         This example shows how to get system properties using
  4.         System class. This example also shows how to get and print
  5.         all system properties.
  6. */
  7.  
  8. import java.util.Properties;
  9.  
  10. public class GetSystemProperties {
  11.  
  12.         public static void main(String[] args) {
  13.                
  14.                 /*
  15.                  * To get system properties use,
  16.                  * static Properties getProperties() of System class.
  17.                  *
  18.                  * getProperties is a static method.
  19.                  *
  20.                  * Plase note that these properties are environment
  21.                  * specific.
  22.                  */
  23.                  
  24.                  Properties prop = System.getProperties();
  25.                  
  26.                  System.out.println("Printing all System properties");
  27.                  
  28.                  /*
  29.                   * To print all system properties use
  30.                   * static void list(PrintStream ps) method of System
  31.                   * class.
  32.                   *
  33.                   * Hint : To print properties on console, paas
  34.                   * System.out to list method.
  35.                   */
  36.                  
  37.                   prop.list(System.out);
  38.                  
  39.                  
  40.         }
  41. }
  42.  
  43. /*
  44. TYPICAL output would be like,
  45.  
  46. Printing all System properties
  47. -- listing properties --
  48. java.assistive=ON
  49. java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
  50. java.vm.version=1.3.1
  51. java.vm.vendor=IBM Corporation
  52. java.vendor.url=http://www.ibm.com/
  53. path.separator=;
  54. java.vm.name=Classic VM
  55. ....
  56. */