This discussion is archived
3 Replies Latest reply: Feb 12, 2012 4:23 PM by 794113 RSS

Cannot pass arguments to an exe file from Java

794113 Newbie
Currently Being Moderated
Hi, I need to run an exe file from Java. The exe runs but I am not able to provide an essential parameter to the exe.

String[] cmd = { "Dir1/the-exe-file","-param1", "<", "text-file.txt"};
Process pr = rt.exec(cmd);

It takes the first argument with no problems. But cannot take the "<" argument. The exe gives error.
In windows command prompt I need to specify that angular bracket as the next parameter is
the input file to the exe.

Do I need to escape it? or what is a solution to this problem?

Thanks

Edited by: kooldba on Feb 12, 2012 2:25 PM

Edited by: kooldba on Feb 12, 2012 2:26 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points