使用setup.jar文件创建新的LibGdx项目后。我按照说明使用IntelliJ配置我的新应用程序并启动桌面应用程序。但我收到以下错误:
Exception in thread "main" java.lang.ClassNotFoundException: com.mygdx.game.desktop.DesktopLauncher
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
DesktopLauncher.java:
package com.mygdx.game.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.mygdx.game.MyGdxGame;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MyGdxGame(), config);
}
}
IDE说“未使用的导入”表明它根本找不到它们。
更新
11:54:56 Gradle 'newgame' project refresh failed:
Cause: org.gradle.plugins.ide.internal.IdeDependenciesExtractor.extractRepoFileDependencies(Lorg/gradle/api/artifacts/ConfigurationContainer;Ljava/util/Collection;Ljava/util/Collection;ZZ)Ljava/util/List;
答案 0 :(得分:5)
这为我解决了这个问题:
在桌面上"运行/调试"配置,选择适当的JRE目录。对我来说,它是:C:\ Program Files \ Java \ jre1.8.0_73。