tags:

views:

1977

answers:

3

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.

A: 

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.

Rayne
A: 
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();     

        }
    }
Pablo Fernandez
+5  A: 

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

Lesson

Specifically, see this image:

Picture of Eclipse Console with Standard Input

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

KC Baltz
That was very helpful .. Thanks a ton