如何在IntelliJ IDEA中运行Java scratch文件 [英] How to run Java scratch file in IntelliJ IDEA
问题描述
我刚开始使用 IntelliJ-14
,我想知道一个临时文件。如果我创建一个java scratch,我可以将其编译为普通的 Java
类。
我已经尝试了什么
在临时文件中创建一个 Java
类但无法找到任何编译方法。
我在寻找什么而不是在现有项目中创建一个新的 Java
文件来运行一些测试代码我只想使用临时文件并编写一些测试类使用main方法并在完成运行后关闭临时文件。这可能吗?
Java临时文件的可执行性是
I just start using IntelliJ-14
and I want to know about a scratch file. If I create a java scratch can I compile this as a normal Java
class.
What I Have Already Tried
Create a Java
class in a scratch file but unable to find any way to compile this.
What I am looking for rather than creating a new Java
file in an existing project for running some test code I just want to use scratch file and write some test class with the main method and after complete running close the scratch file. Is that possible?
Executability for Java scratch files was added in IntelliJ 15, so you must upgrade for that feature.
You have several option how to run/debug the scratch file:
- Click the icon next to the main method/class
- Hit Control+Shift+R (Control+Shift+F10 on Linux/Windows) somewhere within the scratch file
- Right click inside the method/class and select appropriate run/debug option
这篇关于如何在IntelliJ IDEA中运行Java scratch文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!