0

I was wondering why doesn't Eclipse recognize the command (command2="java -cp "+ args[0] + " " + args[1] + < input.txt";)

when I run the command from eclipse, but it works when i run it directly from CMD. How can this issue be fixed?

Thanks

user2597012
  • 581
  • 4
  • 9
  • 28
  • Eclipse doesn't recognize commands. It is a bunch of plugins which sometimes (by accident) compiles Java programs. And Java (java.exe) doesn't know about redirection (this is a feature of the shell, if you want to call cmd.exe a shell). So you should at least invoke `cmd.exe` to do what you want. – Gyro Gearless Oct 17 '13 at 21:24

1 Answers1

0

There's a missing quote:

command2="cmd -C \"java -cp "+ args[0] + " " + args[1] + "< input.txt\"";

Even with redirection, < is still an explicit character (not an operand) in a string representation of the command.

nanofarad
  • 40,330
  • 4
  • 86
  • 117