Skip to main content

Eclipse-how to do "java Sample 55 8"?

1 reply [Last post]
Joined: 2007-03-29

If you use the command-line environment to compile and run a java program called instead of using Eclipse, you could compile by writing "java Sample 30 5" or replace the 30 and 5 with other numbers (lets suppose the needs 2 int inputs). How would you do the equivalent of that when using Eclipse?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-13

You can use following code read the input from keyboard.

String value;
BufferedReader br = new BufferedReader(new InputStreamReader(;
value = br.readLine();
}catch(Exception ex){}

In Eclipse, You can enter the value using "Console" window. If it is not visible, then you can enable it by goign Eclipse Tools > Window > Show Views > Basic > Console