'How can I run cygwin from Java?
I want to start nutch from Java. How can I start cygwin from a Java program?
Solution 1:[1]
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."
Solution 2:[2]
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, as long as you bring a copy of CYGWIN1.DLL as well.
Solution 3:[3]
A more interesting, more clever thing to do, would be starting Nutch from Cygwin or using a real Linux/Unix system.
Solution 4:[4]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adamski |
| Solution 2 | |
| Solution 3 | |
| Solution 4 | Stu Thompson |
