public class Main { public static void main(String[] argv) throws Exception { try { assert argv.length > 0 : "my message"; } catch (AssertionError e) { String message = e.getMessage(); System.out.println(message); } } }