Hello,

I want to create java application which can run .cmd file. I already write the code which run .cmd file, but my problem is the following:
this .cmd file prompts the user to enter his mail and password & I want my program to give these values to the .cmd file & don't take them from user. Is it possible?
the code as the following:

String[] command =
                {
                    "cmd",
                };
                Process p;
                try {
                    p = Runtime.getRuntime().exec(command);
                    new Thread(new SyncPipe(p.getErrorStream(), System.err)).start();
                    new Thread(new SyncPipe(p.getInputStream(), System.out)).start();
                    PrintWriter stdin = new PrintWriter(p.getOutputStream());
                    stdin.println("appcfg.cmd --no_cookies update ..\\HelloGAE\\war");
                    stdin.println("ehossny@xxx.com");// email

                    stdin.println("xxxx");       //password
                    stdin.flush();
                    // write any other commands you want here
                    stdin.close();
                    int returnCode;
                    returnCode = p.waitFor();
                    System.out.println("Return code = " + returnCode);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

That code looks like it does try to supply the email and password. Does appcfg.cmd get its email & password from stdin?

yes, I try to supply the mail and passwod through stdin, but it takes the mail and then through null pointer exception and didn't take password--> I don't know why it reads the mail and didn't read the password??

null pointer exception? YOu should have mentionad that before. Exactly where is it?

actually the o/p which appears to me is as the following:

Email: Password for ehossny@xxx.com: 
java.lang.NullPointerException
Unable to update app: null

this means that stdin reads the email & didn't read the password. I don't know why. So I didn't mention this in my first mail bcos the null pointer exception appears in the o/p & I asked if anyone have a solution to this problem & ignoring my o/p.

I wonder if maybe it's not doing a simple standard read from sysin for the password, ie a special read that doesn't display the input characters?

it may that ur suggestion is true. but how we can do this and make it reads the pass?