Use
System.exit(errorCode);
where errorCode indicates the return code of the program. Usually it's 0 for normal termination.
See the documentation: https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#exit(int)