java - passing password using process builder not working for "net use" command -


I'm trying to apply the "net use" command to the process builder by using it. As I pass the password in the output stream using PrintWriter, it fails with the following error: The system error is 1219. Do not allow multiple connections from one server or shared resources by the same user, use more than one username, disconnect all previous connections for the server or shared resource and try again.

I have checked the user name, password and order manually by running. Its work is fine

Code snippet:

  processbilder PB = new process builder ("net", "use", "\\\\ & lt; SERVERNAME & gt; \\ & lt; SharedLocation & gt; "," / User: & lt; username & gt; "," * "); Process p = pb.start (); Output Stream Out = p.getOutputStream (); Printer author = new printer (out); Author.println ("& lt; pwd>". ToCharArray ()); Int exitCode = p.waitFor (); System.out.println ("Exit Code:" + exitCode);  

Some suggestions:

  • Run . Use pure Java solution instead of
  • Pure use - View

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -