RuntimeException: No suitable ClassLoader found for grab – Grab with main method in IntelliJ

When running a Groovy class with a main method from IntelliJ (12.1.5) that also uses grape @Grab, you get a

Exception in thread "main" java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:188)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Caused by: java.lang.RuntimeException: No suitable ClassLoader found for grab

The easiest solution is to just run the code as a groovy script instead of the main method (e.g. by naming the main method differently and invoking it directly from the script).

This entry was posted in Software. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please solve this little equation for verifying that you\'re human *