-
December 15th, 2021, 12:58 PM
#1
Problem writing from PrintStream to "Console as Process" ,not "console as System.out"
in Java 8, windows 10, i have a text app, i want to open a console and write something there,
first try is:
Code:
String [] cmd = {"cmd.exe", "/c", "start"};
ProcessBuilder f = new ProcessBuilder(cmd);
f.redirectErrorStream(true);
Process p = f.start();
PrintStream printStream=new PrintStream(p.getOutputStream());
//
System.setOut(printStream);
System.out.println("this write in CMD"); //did not work
second try is:
Code:
printStream.println("this write in CMD");//did not work
Can any body Help?
Last edited by alwaystudent; December 15th, 2021 at 01:04 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|