Libgdx - Intellij class not found exception?

I am using it intellijfor the first time, and I was not able to run any program. It builds without any errors or warnings, but when I run it throws class not found exception. I tried everything I could

  • Search on stack overflow.
  • I checked the source folder in the module settings.
  • I also checked startup configurations

but no luck.

Mistake:

Exception in thread "main" java.lang.ClassNotFoundException: com.nectarmicrosystems.libgdx.learning.desktop.DesktopLauncher
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)

class source:

package com.nectarmicrosystems.libgdx.learning.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.nectarmicrosystems.libgdx.learning.MyGdxGame;

public class DesktopLauncher {
    public static void main (String[] arg) {
        LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
        new LwjglApplication(new MyGdxGame(), config);
    }
}

addictions

source structure

+4
source share
2 answers

Thanks to everyone who helped, I found a solution. basically the DesktopLauncher class was not going to compile, so I completed the task with gradle as follows:

gradle IDE, → → .

.

+10

, , "desktop_main" " :".

, " " , , "desktop_main".

+4

Source: https://habr.com/ru/post/1618906/


All Articles