0

In command prompt i usually give input to java program as follows

c:/> java Myprogram < in.txt

this in.txt have input for the Myprogram class

but i cannot do the same in eclipse

i have give the parameter in program arguments in run configuration as

< in.txt

no error is coming. simply the program ask for the input

what should i do.

Mohamed Jameel
  • 602
  • 5
  • 21

2 Answers2

1

The < symbol is something understood and interpreted by the command line. You can't use that in Eclipse.

You Have a look at the answer to this question:

Community
  • 1
  • 1
aioobe
  • 413,195
  • 112
  • 811
  • 826
0

in your main Method, you can get the parameters via the String array the main method has.

public static void main(String [] args){
    for(int i = 0; i <args.length; i++)
        System.out.println(args[i]);
}
CAA
  • 968
  • 10
  • 27