0

Just like this command

java XXX a.txt < b.txt

XXX is a class file. It can run normally if I use java command line. But when use the eclipse and input a.txt < b.txt at the arguments of eclipse.The program was block. This symbol < is just a string in eclipse,but it has some special function in java command line. So how to make the result of eclipse normally? Thank You!

Mechanical snail
  • 29,755
  • 14
  • 88
  • 113
Sunny
  • 101
  • 1
  • 5

1 Answers1

1

On the command line, < b.txt is not part of the command-line arguments.

java XXX a.txt < b.txt

tells the shell to run java XXX a.txt, with the contents of b.txt provided as standard input.

Eclipse apparently does not support this. But if you're willing to change your Java program, you could have it take a second filename as a command-line argument, and read from that (if it is provided) rather than standard input.

Community
  • 1
  • 1
Mechanical snail
  • 29,755
  • 14
  • 88
  • 113
  • Thank you very much! sorry,my English is bad. Thanks for you can understand what I say.I have implemented a method by using `System.setIn()`. – Sunny Dec 23 '12 at 04:23