![could not find or load main class intellij could not find or load main class intellij](https://bgasparotto.com/wp-content/uploads/2020/11/intellij-invalidate-caches-restart.png)
- COULD NOT FIND OR LOAD MAIN CLASS INTELLIJ ANDROID
- COULD NOT FIND OR LOAD MAIN CLASS INTELLIJ CODE
- COULD NOT FIND OR LOAD MAIN CLASS INTELLIJ WINDOWS
See this example of generating a class file of a simple code: 1. Could not find or load main class with IntelliJ Application configuration When trying to reproduce your libgdx example the very first time everything worked.
![could not find or load main class intellij could not find or load main class intellij](https://static.javatpoint.com/core/images/could-not-find-or-load-main-class-in-java3.png)
class name to run the classpath or the corresponding .class files have been altered. When the JVM is unable to locate the main class, it is usually because you would have entered the wrong.
COULD NOT FIND OR LOAD MAIN CLASS INTELLIJ CODE
Why does the “JVM could not find or load the main class” error occur?Īs the name suggests, the ‘could not find or load main class’ error means that the JVM ( Java Virtual Machine) could not locate the main class in your code and throws this runtime error. And we know it has nothing to do with our code. Whether you’re just starting out as a programmer or have some experience under the belt, we’ve all seen this error at least once.
![could not find or load main class intellij could not find or load main class intellij](https://abcstudyguide.com/wp-content/uploads/2021/07/main-class-intellij.png)
If you keep getting this error without any specific reason, you are not alone. Code completion is not working in IntelliJ IDEA 2019.1. Java developers often face the ‘could not find or load main class’ error out of the blue during compilation. IntelliJ Idea 'could not find or load main class' Ask Question Asked 2 years, 11 months ago.
COULD NOT FIND OR LOAD MAIN CLASS INTELLIJ ANDROID
Workarounds include patching the android.jar file, automatically removing the Android-Gradle facet on sync, or moving the android module to an external project. There's is currently no way to apply the android plugin to only android modules. For kotlin modules, the main class can't be found at runtime since the classpath is wrong. When applied to a module, it adds an Android-Gradle facet that changes the module classpath from the default out/classes to build/classes/java. The module needs the android gradle plugin which is globally applied to all modules in the project, even those which aren't android modules. The issue comes from the fact that the project has an Android module. JVM: openjdk version "1.8.0_212" (AdoptOpenJDK) When changing the working directory in the launch configuration to the android/assets directory, just like you did in your gradle task, the demo will launch successfully.įor the record my environment: OS: MacOs Mojave GdxRuntimeException: Couldn't load dependencies of asset: libgdx.png
![could not find or load main class intellij could not find or load main class intellij](https://i.stack.imgur.com/N26Pn.png)
The next attempt fails with this exception. This can be fixed by editing the launch configuration and add -XstartOnFirstThread to VM options. AWT or JavaFX) is initialized before GLFW. For offscreen rendering, make sure another window toolkit (e.g. Please run the JVM with -XstartOnFirstThread.
COULD NOT FIND OR LOAD MAIN CLASS INTELLIJ WINDOWS
When you then hit the "run" button next to the main method, it fails like this: Caused by: : GLFW windows may only be created on the main thread and that thread must be the first thread in the process. What command do you use to run the jar file Below is the command to run an executable jar file: java -jar jarfile. Just replace the word java in the path with kotlin: Error: Could not find or load main class package.classname. To fix the issue Open the Module Settings (F4) of the project and change the "module compile output path" of the modules desktop and core to the kotlin output path. It looks for build/java/main instead of build/kotlin/main. From then on it kept failing.Īpparently somehow IntelliJ gets the classpath wrong when importing this project from gradle. The second attempt to freshly import the project and take screenshots along the way failed like yours. When trying to reproduce your libgdx example the very first time everything worked.