I want to start nutch from Java. How can I start cygwin from a Java program?
Rather than use Java to start Cygwin in order to invoke nutch you should probably look into integrating Nutch directly with your Java app. There's some documentation here:
"While the Nutch web app is a great way to get started with search, most projects using Nutch require the search function to be more tightly integrated with their application. There are various ways to achieve this, depending on the application. The two ways we'll look at here are using the Nutch API and using the OpenSearch API."
You can use any Cygwin program without passing thru Cygwin, just like any regular Windows Console Application. Take a look at the Cygwin\bin\ dir. You may even bring the programs you want to your app dir, sinse you bring a copy of the CYGWIN1.DLL with them.
First of all you have to set the bash.exe to environment variable so this line will start bash.
Runtime rt= Runtime().getRuntime().execute("bash");
If you are trying to run a binary that requires the cygwin1.dll (which includes most commands you can execute from the cygwin bash shell) then you can run it by specifying the cygwin\bin directory in the path environment variable like this:
Process p = Runtime.getRuntime().exec(
"C:/path/to/cygwin/binary.exe", new String[] { "PATH=C:\\cygwin\\bin" });
This assumes you installed cygwin in C:\cygwin