runIde fails with 'Could not find or load main class com.intellij.idea.Main' Follow
Hello!
We develop a plugin for PyCharm and we wanted to make sure it is compatible with the upcoming PyCharm 223 version before it is released. We reference to the latest PyCharm EAP (223-EAP-SNAPSHOT - 2022-10-05 12:57:45 UTC - 223.6160.21) in the Gradle configuration, but we are not able to launch the the plugin from IntelliJ.
We had to change the SDK of the project to JDK 17 (apparently that is the required version of Java now), but the Gradle's build and runIde task fail. These are the outputs so far:
build:
Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
Error: Could not find or load main class com.intellij.idea.Main
Caused by: java.lang.ClassNotFoundException: com.intellij.idea.MainCould not find or load main class com.intellij.idea.Main
Caused by: java.lang.ClassNotFoundException: com.intellij.idea.Main
Execution failed for task ':buildSearchableOptions'.
> Process 'command 'C:\Program Files\Java\jdk-17.0.5\bin\java.exe'' finished with non-zero exit value 1* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
runIde
Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
Error: Could not find or load main class com.intellij.idea.Main
Caused by: java.lang.ClassNotFoundException: com.intellij.idea.MainCould not find or load main class com.intellij.idea.Main
Caused by: java.lang.ClassNotFoundException: com.intellij.idea.Main
Execution failed for task ':runIde'.
> Process 'command 'C:\Program Files\Java\jdk-17.0.5\bin\java.exe'' finished with non-zero exit value 1* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
We enabled the debug flag to see if something more was being logged and we found these lines (don't know if they are relevant):
2022-10-19T14:23:23.707+0200 [WARN] [org.jetbrains.intellij.IntelliJPlugin] [gradle-intellij-plugin :digi-pycharm:runIde] Cannot find java executable in: C:\Users\diescalo\.gradle\caches\modules-2\files-2.1\com.jetbrains\jbre\jbr-17.0.4.1-windows-x64-b629.2\extracted
2022-10-19T14:23:23.707+0200 [DEBUG] [org.jetbrains.intellij.IntelliJPlugin] [gradle-intellij-plugin :digi-pycharm:runIde] Runtime specified with ideDir='C:\Users\diescalo\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.pycharm\pycharmPC\223-EAP-SNAPSHOT\5740e051d5907186a5c2258931bb1120b6b4a860\pycharmPC-223-EAP-SNAPSHOT', version='17.0.4.1b629.2' resolved as: null
2022-10-19T14:23:23.707+0200 [DEBUG] [org.jetbrains.intellij.IntelliJPlugin] [gradle-intellij-plugin :digi-pycharm:runIde] Cannot resolve runtime with ideDir='C:\Users\diescalo\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.pycharm\pycharmPC\223-EAP-SNAPSHOT\5740e051d5907186a5c2258931bb1120b6b4a860\pycharmPC-223-EAP-SNAPSHOT', version='17.0.4.1b629.2'
2022-10-19T14:23:23.707+0200 [DEBUG] [org.jetbrains.intellij.IntelliJPlugin] [gradle-intellij-plugin :digi-pycharm:runIde] Cannot resolve runtime with ideDir='C:\Users\diescalo\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.pycharm\pycharmPC\223-EAP-SNAPSHOT\5740e051d5907186a5c2258931bb1120b6b4a860\pycharmPC-223-EAP-SNAPSHOT'
2022-10-19T14:23:23.708+0200 [DEBUG] [org.jetbrains.intellij.IntelliJPlugin] [gradle-intellij-plugin :digi-pycharm:runIde] Using current JVM: C:\Program Files\Java\jdk-17.0.5\bin\java.exe
2022-10-19T14:23:23.708+0200 [INFO] [org.jetbrains.intellij.IntelliJPlugin] [gradle-intellij-plugin :digi-pycharm:runIde] Resolved JVM Runtime directory: C:\Program Files\Java\jdk-17.0.5\bin\java.exe
We had no problems with version 222 of PyCharm. The main difference between them is that for version 222, the SDK of the project is JDK 15 while for version 223 we had to change it to JDK 17 (we suppose the JBR of the product changed from 15 to 17).
Any clue about what could be happening?
Thanks!
Please sign in to leave a comment.
The Gradle IntelliJ Plugin needs to be switched to use SNAPSHOT version for now, as the last release does not support 2022.3 EAP IDE releases yet. Please see https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#snapshot-release.
Indeed Java 17 is required as noted here https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#intellij-platform-based-products-of-recent-ide-versions
Switching the Gradle IntelliJ Plugin to 1.10.0-SNAPSHOT version did the trick. Thank you so much for your help!