How to use Groovy Shell in Java9+?
Answered
This error is encountered when starting Groovy Shell:
`CommandLineWrapper` is ill-suited for launching apps on Java 9+.
If the run configuration uses "classpath file", please change it to "@argfile".
Otherwise, please contact support.
The solution given above is to change the ‘run configuration’, and after querying it, I learned that the option should be ‘Shorten command line’, but no similar option is found in Groovy’s run configuration.

Please sign in to leave a comment.
What is the version of IntelliJ IDEA? That should have been fixed in 2020.3: https://youtrack.jetbrains.com/issue/IDEA-246923
There is no option for shorten command line, it is available for the Application type of Run Configuration only: https://i.imgur.com/mzUWdmI.png
@Konstantin Annikov
I'm using the 2021 version.
Please share a aproject sample where this could be reproduced.
Konstantin Annikov
The file has been uploaded
https://github.com/Andy-AO/ShareFiles/blob/main/groovy-project.zip
The problem still exists after upgrading to IntelliJ IDEA 2021.1.3.
This error is kind of expected because if groovy-xml jar is in the classpath, then one should have jaxb in the classpath as well.
Workaround is to set project SDK to Java 1.8
OK, it can be used temporarily.
But will this function stay in Java 1.8 forever?
Is there a plan for improvement?
Just add jaxb in the classpath to make it work with Java >1.8.
Konstantin Annikov I know this is an old topic, but this just reared its ugly head for me. Add jaxb to which classpath? Where do I find that?
I love the Groovy console. It's so handy for quick tests. Would really like to get it working again.
IntelliJ IDEA 2023.2.1 (Ultimate Edition)
Build #IU-232.9559.62, built on August 22, 2023
Thanks!
Hi Jeffrey Verdegan Could you clarify a bit more details about the problem? A couple of screenshots and a project sample would help to fully understand your case. Files can be uploaded at https://uploads.jetbrains.com (do not forget to specify the UploadID)
The `Groovy Shell` action was removed a couple of releases ago and doesn't exist in the 2023.2.1 IDE build so it is likely that you experience a different problem related to Groovy Console specifically
I couldn't reproduce this problem in Groovy Console using openjdk-20 and a simple Groovy script
Hi, Egor,
I found a fix,
Vanilla SDK for the module works, while IJ SDK does not, although both end up launching the same vanilla JVM, just with different args.
I created a brand new dummy project to reproduce the problem, and, of course, it didn't reproduce the problem. So I looked a little closer.
Dummy project | Settings | Modules | Module SDK -→ SDK 17 (default Java on my Windows laptop).
In Groovy Console I enter
println 1and hit go. It works.Actual “Broken” project | Settings | Modules | Module SDK -→ IntelliJ IDEA IU-211.7142.45.
Same Groovy Console actions. I get the error as expected.
But then when I switch my real project over to the vanilla SDK, it also works fine.
I'll leave it to you guys to figure out if this is a bug with the IJ SDK or how it's used here, or if it's expected behavior. Either way, I got my Groovy back, so thanks!
--Jeff
I guess the
@C:\Users\jverdegan\AppData\Local\Temp\idea_arg_file46330056vs.
-classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2023.1.2\lib\idea_rt.jar"is exactly what the error message was talking about.
Hello Jeffrey Verdegan,
I created bug in YouTrack: IDEA-332145