Reputation: 51
How do I enable assertions in IntelliJ? My code compiles but the assertions do not show up anywhere on the output.
For example:
public static void main(String[] args) {
int someInt = 5;
assert someInt > 5;
assert someInt <= 5;
}
Upvotes: 4
Views: 3499
Reputation: 8767
Based on this answer for Eclipse you need to pass a JVM option -ea
to enable assertions in any JVM. It's not unique to any specific IDE.
For IntelliJ it looks like this in the run config:
Note that you may have to select "Modify Options" to make the JVM options input box visible to enter the -ea
flag.
Upvotes: 10