启动桌面主时的 libgdx ClassNotFoundException - Mac,IntelliJ [英] libgdx ClassNotFoundException when starting Desktop main - Mac, IntelliJ

查看:23
本文介绍了启动桌面主时的 libgdx ClassNotFoundException - Mac,IntelliJ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 IntelliJ 设置教程中的说明设置我的项目,但是我无法启动桌面应用程序.android 应用程序在模拟器和我的 S3 上都可以正常启动,但桌面中的 main 无法找到我的类..

I set up my project as described in the IntelliJ setup tutorial, but I am unable to start the Desktop application. The android app starts up fine in both the emulator and on my S3, but main in Desktop is unable to find my class..

日志:

Exception in thread "main" java.lang.ClassNotFoundException: com.xxx.xxx.xxx.DesktopStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)

我正在运行 Mac OSX 10.7.5、Apple 的 Java JDK 1.6.0_43 和 IntelliJ 12.0.4.我觉得这很简单,我似乎无法找到问题所在.(别笑我的班级名字,这是给我4岁的女儿);D

I am running Mac OSX 10.7.5, Apple's Java JDK 1.6.0_43, and IntelliJ 12.0.4. I feel like it is something dead simple, I just can't seem to find the issue. (Don't laugh at my class name, it's for my 4yr old daughter) ;D

推荐答案

LibGDX 1.7.1、IntelliJ IDEA 15.0、Windows 8.1 -- 我一直在尝试通过 IDE 的运行配置对话框运行 DesktopLauncher 时遇到问题.

LibGDX 1.7.1, IntelliJ IDEA 15.0, Windows 8.1 -- I kept getting the problem trying to run DesktopLauncher through the IDE's Run Configurations dialogs.

相反,运行 Gradle 任务(桌面 -> 运行)可以完美运行.

Instead, running the Gradle task (desktop -> run) works perfectly.

要在 IntelliJ 中运行 Gradle 任务,

To run the Gradle task within IntelliJ,

  1. Shift 两次,输入Gradle"以打开 Gradle 项目窗格
  2. 如果没有显示任何内容,请点击刷新所有 Gradle 项目"按钮
  3. 展开:桌面>任务>其他
  4. 双击运行"
  1. Hit Shift twice, type "Gradle" to open the Gradle projects pane
  2. Hit the "Refresh all Gradle projects" button if nothing is showing up
  3. Expand :desktop > Tasks > other
  4. Double-click "run"

这篇关于启动桌面主时的 libgdx ClassNotFoundException - Mac,IntelliJ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆