I am using cygwin to get unix environment on windows.
I have some shell script that run on cygwin to perform syncing works and other things. I want to executes these script through java code.
Also during executing of scripts on cygwin , certain information is displayed on terminal by using simple echo command.. I want to show all that information in my application.
How can I do this??
You can use something like this
p.s. this doesn't handle errors
Use the Runtime class to run Cygwin. This is very brittle, and dependent upon your setup, but on my machine I would do:
Then wait for the Process to complete, and get a handle to it's InputStream objects to see what was sent to stdout and stderror.
The first part of the command is to run cygwin, and the second is to execute some script, or command (using
-e
or--exec
). I would test this command on the DOS prompt to see if it works first before cutting any code. Also, take a look at the options available by doing:Also from within the DOS prompt.
EDIT: The following works for me to print version information
Unfortunately, can't seem to get it working with
--exec
, so you're going to have to do some more research there.