使用 Eclipse 打开命令提示符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/199426/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open command prompt using Eclipse
提问by user21968
I am new to Java and am trying to run a program using Eclipse. But I have no idea how to get the command prompt running in with Eclipse...
我是 Java 新手,正在尝试使用 Eclipse 运行程序。但我不知道如何在 Eclipse 中运行命令提示符......
I did some online research and couldn't get anything consolidated!
我做了一些在线研究,但无法整合任何东西!
Update:
更新:
I'm not using an applet. It's a normal Java program trying to read a line from command prompt. I'm trying to do system programming.
我没有使用小程序。这是一个普通的 Java 程序,试图从命令提示符中读取一行。我正在尝试进行系统编程。
回答by KC Baltz
回答by Rayne
If you downloaded the Eclipse/Java package, and you wrote a Java program in Eclipse in a project, just click compile and run, it will run in the output window in Eclipse.
如果你下载了Eclipse/Java包,在一个项目中用Eclipse编写了一个Java程序,只要点击编译运行,它就会在Eclipse的输出窗口中运行。
回答by Pablo Fernandez
Try this:
import java.util.Scanner;
public class ReadFromPrompt{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String line = in.nextLine();
}
}
回答by Karthik Reddy
Right Click on your project--->Run As--->Run Configurations...--->Select Arguments-->Enter the values---->Run