使用标准main(String [] args)方法运行单个java文件 - Android Studio [英] Run single java file with standard main(String [] args) method - Android Studio

查看:164
本文介绍了使用标准main(String [] args)方法运行单个java文件 - Android Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先 - 是的,我知道这很疯狂/奇怪。但是我需要它:)。

To start with - Yes, I know that this is crazy/strange. But I need it :).

我想找到最简单的方法来运行单个java文件(并且更喜欢非终端答案:) - 如果它们是可能的)在Android Studio中。我的意思是我的Android项目中的随机.java文件,我将在其中编写main(..)方法。还有一件事:我不想创建任何新模块(我已经看到了有关添加Java库模块的答案)。我只想点击一下并运行我的(单个)文件,就像我在Eclipse中一样。有可能吗?

I want to find simpliest way to run single java file (and prefer non-terminal answers :) - if they are possible ) in Android Studio. I mean random .java file from my Android project in which I'll write main(..) method. And there's one more thing: I don't want to create any new modules (I've already seen answers about adding Java library module). I just want to click something and run my (single) file, the same way as I can do it in Eclipse. Is it possible?

推荐答案

如果没有别的,你可以做一个快速的JUnit测试来调用你的类的主要方法。

If nothing else, you can make a quick JUnit test that calls your class's main method.

这篇关于使用标准main(String [] args)方法运行单个java文件 - Android Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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