JShell won't run - missing main class

Answered

Trying to run JShell in IntelliJ 2019.2.1, but I get this in the Run console:

"/Applications/IntelliJ IDEA.app/Contents/jbr/Contents/Home/bin/java" -classpath "/Applications/IntelliJ IDEA.app/Contents/lib/jshell-frontend.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/java/lib/jshell-protocol.jar" com.intellij.execution.jshell.frontend.Main
Error: Unable to initialize main class com.intellij.execution.jshell.frontend.Main
Caused by: java.lang.NoClassDefFoundError: jdk/jshell/Snippet$Status
1
5 comments

Don't use JetBrains Runtime for development, change your project JDK to a real JDK in the Project Structure dialog.

4
Avatar
Permanently deleted user

Thank-you! That worked. I wondered why I had an 11.0.3 version of the JDK and had not noticed it was built-in.

0
Avatar
Permanently deleted user

Could you provide an example of how to "change your project JDK to a real JDK in the Project Structure dialog" ? Thank you

0

I think I might know why few people, as it was noted in a different issue, use jshell.

Four years later, jetbrains still ships with a jre that won't run jshell.

I don't want to be one of those guys who bitches about products I get for free, but why not remove the jshell support, throw it on github as a separate project ( that does not require rebuilding your IDE ), and see if somebody rises to the challenge and converts it to a plugin?

Also, for what it's worth,  this whole business of every java project shipping it's own JDK, kinda defeats the purpose of "Write Once Run Everywhere".  I always seem to have 18 jdks on my system, each of which will do almost ( but not quit ) what I need it to do at any given moment.

 

0

Please sign in to leave a comment.