简体   繁体   中英

How i run cygwin using java program?

I have installed cygwin on window to start crawling. It work well. Now i want to run cygwin and run a crawl program at starting of cygwin using java program code.

If you provide some code for it ,it will be great help for me.

I looked at adatapost's link. It seems like a world of trouble awaits you down this path.

I mean, I like Cygwin a lot, but I wouldn't use it like this.

A few centimetres to the right of the 'Your Answer' box I'm typing in is a link to a Related question 'How can I run cygwin from Java?'

Who's putting the cart before the horse? I don't know.

Does Cygwin have to be involved at all ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM