How do I run cygwin from Java?

I want to start a nut with Java. How do I start cygwin from a Java program?

+2


source to share


5 answers


First of all you need to set the environment variable bash.exe for this line to start bash.



Runtime rt= Runtime().getRuntime().execute("bash");

      

0


source


Instead of using Java to run Cygwin to call nutch, you should probably look into integrating Nutch directly with your Java application. There's documentation here :



"While the Nutch web app is a great way to start searching, most projects using Nutch require the search functionality to be more tightly integrated with their app. There are different ways to accomplish this depending on the app. We'll cover two ways here. using the Nutch API and using the OpenSearch API.

+2


source


You can use any Cygwin program without going through Cygwin just like any regular Windows console application. Take a look at Cygwin \ bin \ dir. You can even bring the programs you want to use in your application and you can bring a copy of CYGWIN1.DLL with you.

0


source


The more interesting, smarter thing is to start Nutch from Cygwin or use a real Linux / Unix system.

0


source


If you are trying to run a binary that requires cygwin1.dll

(which includes most of the commands you can run from the cygwin bash shell), you can run it by specifying the cygwin \ bin directory in your path environment variable e.g .:

Process p = Runtime.getRuntime().exec(
      "C:/path/to/cygwin/binary.exe", new String[] { "PATH=C:\\cygwin\\bin" });

      

This assumes you have installed cygwin in C:\cygwin

0


source







All Articles