Java System get environment properties

Introduction

The following properties are available within JVM:

file.separator                 java.specification.version        java.vm.version 
java.class.path                java.vendor                       line.separator 
java.class.version             java.vendor.url                   os.arch 
java.compiler                  java.version                      os.name 
java.ext.dirs                  java.vm.name                      os.version 
java.home                      java.vm.specification.name        path.separator 
java.io.tmpdir                 java.vm.specification.vendor      user.dir 
java.library.path              java.vm.specification.version     user.home 
java.specification.name        java.vm.vendor                    user.name 
java.specification.vendor //from  w  w w .ja v a  2  s .  c om

For example, the following program displays the path to the current user directory:

public class Main {
  public static void main(String args[]) {
    System.out.println(System.getProperty("user.dir"));
  }/* w  w w .j av  a 2s  .c  o m*/
}



PreviousNext

Related