If I activate assertions following the Oracle documentation
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
ClassLoader.getSystemClassLoader().setPackageAssertionStatus("richtercloud.java.assertion.ignored", true);
System.out.println(String.format("desired assertion status: %b",
NewMain.class.desiredAssertionStatus()));
assert false;
System.out.println("assertion has been ignored");
in the main method of a class richtercloud.java.assertion.ignored.NewMain, I see from the printed statement that assert false doesn't cause an AssertionError like it's caused if I package NewMain in a JAR and run it with java -ea -jar java-assertion-ignored-1.0-SNAPSHOT-jar-with-dependencies.jar richtercloud.java.assertion.ignored.NewMain.
Other questions regarding programmatic enabling of assertion only suggest to not use assertions which is obviously not a solution.