简体   繁体   中英

Open command prompt using Eclipse

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...

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.

Check out this lesson plan on how to get started with Eclipse programs:

Lesson

Specifically, see this image:

带有标准输入的Eclipse控制台的图片

If the Console tab is not visible in your Eclipse, go to Window -> Show View -> Console in the menu bar.

Right Click on your project--->Run As--->Run Configurations...--->Select Arguments-->Enter the values---->Run

如果您下载了Eclipse / Java包,并且在项目中在Eclipse中编写了Java程序,只需单击编译并运行,它将在Eclipse的输出窗口中运行。

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();     

        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM