Just call HotSpotDiagnostic.setVMOption("HeapDumpPath","/tmp") and you get the exception below:
$ /usr/java/jdk1.7.0/bin/java -jar /tmp/Test/dist/Test.jar
Exception in thread "main" java.lang.NullPointerException
at sun.management.HotSpotDiagnostic.setVMOption(HotSpotDiagnostic.java:113)
at test.Main.main(Main.java:19)
$ /usr/java/jdk1.7.0/bin/java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b59)
Java HotSpot(TM) Client VM (build 16.0-b03, mixed mode, sharing)
$