Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Runtime.getRuntime().exec(java test)

843798Jul 23 2001 — edited Jul 24 2001
Hi,
As part of a thesis for college, I am trying to execute a test java program. The program executes okay and I can read the results okay.

Sample code.
process = Runtime.getRuntime().exec("java test");
InputStream iOutStream = process.getInputStream();
InputStream ErrorStream = process.getErrorStream();


However, I need to be able to execute a progam that reads a parameter from the screen. I tried to pass a parameter file but it doesn't work.
process = Runtime.getRuntime().exec("java test <input.txt");


I also tried just passing the parameters as a string array but it doesn't work either.
process = Runtime.getRuntime().exec("java test 2, 2");

Is there any other way that I can get the process to accept parameters?


My deadline is looming so any help would be greatly appreciated.
Thanks
Eleanor
eleanmck@gofree.indigo.ie
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 21 2001
Added on Jul 23 2001
3 comments
357 views