在 Android Studio 中运行 Java 应用程序 [英] Running Java application in Android Studio
问题描述
我创建了新的 libgdx 项目,我想在 Android Studio 中运行桌面应用程序.与运行配置有关吗?在 Eclipse 中,我可以选择 Run as Java Application.
I created new libgdx project and i want to run desktop application in Android Studio. Is there something to do with run configurations? In Eclipse i can just choose Run as Java Application.
推荐答案
好的,我做到了.这是解决方案 https://github.com/libgdx/libgdx/wiki/Gradle-and-Intellij-IDEA#running-your-project
Ok, i did it. Here is the solution https://github.com/libgdx/libgdx/wiki/Gradle-and-Intellij-IDEA#running-your-project
运行 ->编辑配置...
,单击加号 (+
) 按钮并选择应用程序.
Run -> Edit Configurations...
, click the plus (+
) button and select Application.
将名称设置为 Desktop
.
将字段Use classpath of module
设置为desktop
,然后点击Main class
字段的按钮,选择DesktopLauncher
类.
Set the field Use classpath of module
to desktop
, then click on the button of the Main class
field and select the DesktopLauncher
class.
将工作目录
设置到您的android/assets/
(或your_project_path/core/assets/
)文件夹!
Set the Working directory
to your android/assets/
(or your_project_path/core/assets/
) folder!
点击Apply
,然后点击OK
.
您现在已经为桌面项目创建了运行配置.您现在可以选择配置并运行它.
You have now created a run configuration for your desktop project. You can now select the configuration and run it.
这篇关于在 Android Studio 中运行 Java 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!