Hello,
I am having a problem passing arguments to a Java application. If I run it from command prompt, I can just input the following:
Java IRC -NICK GV_CONTROLLER82 -INSTRUCTOR Spiro -SESSIONID 82
And it works perfectly.
However I need to execute the java IRC application from another java app. I do this by using Runtime.exec(). It works if I don’t send the arguments.
I need to know how to send the above arguments to using runtime.exec()
Please Help!
This is the code segment below:
Code:private void SessionStart() { String[] cmd = {"java","IRC -NICK GV_CONTROLLER82 -INSTRUCTOR Spiro -SESSIONID 82"}; try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(cmd); int exitVal = proc.waitFor(); System.out.println("Process exitValue: " + exitVal); } catch (Throwable t) { t.printStackTrace(); }; }


Reply With Quote


Bookmarks