troubleshooting Question

Send input to exec process in windows

Avatar of old_type
old_type asked on
Web Languages and StandardsJava
51 Comments1 Solution525 ViewsLast Modified:
hi experts,

im working on a small programming project that will act as a front end to another written program, basically im making a GUI for it

i have comepleted most of the parts, except i would like to run everthing in the java window, so i would like to send user input directly to the dos program using java, instead of the user typing it into the dos window, after i have called the exec command, i have some code here of how i tried to do it, but it doesnt work, plz advise

and yes, im a newbie

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
// send process the password
// pass alrdy has the password
pass = pass.concat(System.getProperty("line.separator"));
PrintWriter writer = new PrintWriter(proc.getOutputStream());
int exitVal = proc.waitFor();

// done encryption
String done = "Decrypted ";
done = done.concat(arg1.getName());
JOptionPane.showMessageDialog(ivjJFrameContentPane, done);

thats it, thanks people

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 51 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 51 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros