adam bien's blog

Java: How to Convert a System Property In A Boolean 📎

The method java.lang.Boolean.getBoolean("KEY") converts the value of the system property with the given key to a boolean:


//...
public static void main(String[] args) {
    boolean dryRun = Boolean.getBoolean("dry.run");
}

Since Java 1.0.2 the test is case insensitive :-).