Set System Properties in Java

Description

The following code shows how to set System Properties.

Example


//from w  ww  .  j  a v  a2s  .c  o m
public class Main {
  public static void main(String[] a) {
    String oldValue = System.clearProperty("java.class.path");
    System.setProperty("user.dir", "C:/MyProg");
    System.out.println(System.getProperty("user.dir"));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Development »




Java Algorithms
Java Clipboard
Java Compiler
Java Desktop
Java Virtual Machine
Java Math
OS
Random
Java Robot
Java RuntimeMXBean
Java Timer
Java UUID
Java Internationalization