Executing a unix command

Hi,
I need to execute the following unix command through my java code -

zip -e

When i execute this command from the command prompt, i am prompted for a password in the following manner -
Enter password:
Verify password:

Is it possible to provide the password inthe first command itself so that i am not prompted for it?

Any help in this regard will be highly appreciated!!

Hi,
I just want a general approach for this problem for any unix command. That is, say any unix command on execution , prompts for some more info to be entered (say password in my case); how can i provide that additional info in the first command itself so that i can bypass the prompt for additional data.

Regards,
Jacob

Not sure about java, but you can do this with expect - http://expect.nist.gov/

You could also try ksh's co-process. See the man pages of ksh to know more on co-process.

Thanks for the reply.

Can you give some examples?

Here's some expect script examples:
http://www.cpqlinux.com/expect.html

And here's my ftp ksh script that uses a co-process