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.

2 Answers 2

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:

Sign up to request clarification or add additional context in comments.

Comments

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]);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.