Re: Spawning Java from C
On 24/02/2012 15:07, Eliot Moss wrote: > On 2/24/2012 9:57 AM, Jim Rome wrote: >> Larry Hall (Cygwin cygwin.com> writes: >>> >>> To the OP, run the same from an elevated prompt and these >>> errors should disappear. >>> >> >> I tried it also with windows style paths, both using \\ and / as >> separators with the same results. >> >> What does "to the OP" mean? And are you implying it has to be run >> as an administrator? MinGW does not require that. > > OP = Original Poster (see the cygwin standard acronyms :-) ) > > Yes, the responder *is* saying that you need to run this as > administrator. No. He was saying that if you run *cygcheck* from an elevated prompt, you won't get the "Can't open service" errors. cheers, DaveK -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
On 2/24/2012 11:13 AM, Jim Rome wrote: That did it, although I think I tried it with no quotes before. I also used Windows paths with / in them. This was really frustrating. Cygwin should have better documentation about issues like this. Glad to be of help. A bunch of this *is* documented, some of it being standard bash-ness and some of if being more specific to cygwin and paths ... EM -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
> Here's the thing I am wondering about: > > In bash, in a " " quoted string, backslash acts kind of as in C and may > need to be escaped (doubled). It can be tricky/painful to find the > right quoting/escaping combination to get what is necessary. In a > ' ' quoted string, you get what you type. So it would be interesting > to see the line that tries to invoke java. You might need to run a > script with -v or -x (or both) in effect to see exactly what bash > is doing ... > That did it, although I think I tried it with no quotes before. I also used Windows paths with / in them. This was really frustrating. Cygwin should have better documentation about issues like this. Thanks for the help, Jim -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
On 2/24/2012 10:56 AM, Jim Rome wrote: Could you post the command line(s) you used? Maybe we can spot something EM Usage: tkfPush port tkf_file_name_path launch_java(t/f) C:\Users\jar>tkfpush 4879 Bar.tkf t Client: WSAStartup() is OK. jar location="C:\Users\jar\Tekdraw2\tekPlot\dist\tekPlot.jar" Client: WSAStartup() is OK. Client: socket() is OK. Unable to access jarfile "C:\Users\jar\Tekdraw2\tekPlot\dist\tekPlot.jar" socket connect failed: No error Client: connect() - Failed to connect. Here's the thing I am wondering about: In bash, in a " " quoted string, backslash acts kind of as in C and may need to be escaped (doubled). It can be tricky/painful to find the right quoting/escaping combination to get what is necessary. In a ' ' quoted string, you get what you type. So it would be interesting to see the line that tries to invoke java. You might need to run a script with -v or -x (or both) in effect to see exactly what bash is doing ... EM -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
> Could you post the command line(s) you used? Maybe > we can spot something EM > Usage: tkfPush port tkf_file_name_path launch_java(t/f) C:\Users\jar>tkfpush 4879 Bar.tkf t Client: WSAStartup() is OK. jar location="C:\Users\jar\Tekdraw2\tekPlot\dist\tekPlot.jar" Client: WSAStartup() is OK. Client: socket() is OK. Unable to access jarfile "C:\Users\jar\Tekdraw2\tekPlot\dist\tekPlot.jar" socket connect failed: No error Client: connect() - Failed to connect. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
On 2/24/2012 10:38 AM, Jim Rome wrote: Yes, the responder *is* saying that you need to run this as administrator. I can't speak for the difference with MinGW. Eliot Moss I reran this in a Windows 7 command window as an administrator, using the Windows style paths using \\, and still get the same result. It cannot find the jar file. Is there anyway of putting in some debugging statements in the spawn process? Could you post the command line(s) you used? Maybe we can spot something :-) EM -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
> Yes, the responder *is* saying that you need to run this as > administrator. I can't speak for the difference with MinGW. > > Eliot Moss I reran this in a Windows 7 command window as an administrator, using the Windows style paths using \\, and still get the same result. It cannot find the jar file. Is there anyway of putting in some debugging statements in the spawn process? Thanks, Jim -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
On 2/24/2012 9:57 AM, Jim Rome wrote: Larry Hall (Cygwin cygwin.com> writes: To the OP, run the same from an elevated prompt and these errors should disappear. I tried it also with windows style paths, both using \\ and / as separators with the same results. What does "to the OP" mean? And are you implying it has to be run as an administrator? MinGW does not require that. OP = Original Poster (see the cygwin standard acronyms :-) ) Yes, the responder *is* saying that you need to run this as administrator. I can't speak for the difference with MinGW. Eliot Moss -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
Larry Hall (Cygwin cygwin.com> writes: > > To the OP, run the same from an elevated prompt and these > errors should disappear. > I tried it also with windows style paths, both using \\ and / as separators with the same results. What does "to the OP" mean? And are you implying it has to be run as an administrator? MinGW does not require that. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
On 2/23/2012 3:21 PM, Eliot Moss wrote: On 2/23/2012 12:35 PM, James Rome wrote: I have code that launches Java from C to run a jar file, and creates a socket to communicate between the calling program and the jar file. It works in OS X, Linux, and MinGW on Windows, but not on Cygwin. One can definitely spawn Java from C, but every JVM I know of is a *Windows* application, which mean that it wants *Windows paths*, not cygwin-style paths. You may find the cygpath utility useful in scripts run under cygwin, to convert between different styles of path. Java, in particular, wants things like its classpath as a *semicolon*-separate list of *Windows* path names. These generally require suitable quoting if being used in scripts or with bash, since bash interprets semicolcon as separating bash commands, etc. As for the particular errors, I am personally less familiar with using cygrunsrv ... To the OP, run the same from an elevated prompt and these errors should disappear. -- Larry _ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Spawning Java from C
On 2/23/2012 12:35 PM, James Rome wrote: I have code that launches Java from C to run a jar file, and creates a socket to communicate between the calling program and the jar file. It works in OS X, Linux, and MinGW on Windows, but not on Cygwin. One can definitely spawn Java from C, but every JVM I know of is a *Windows* application, which mean that it wants *Windows paths*, not cygwin-style paths. You may find the cygpath utility useful in scripts run under cygwin, to convert between different styles of path. Java, in particular, wants things like its classpath as a *semicolon*-separate list of *Windows* path names. These generally require suitable quoting if being used in scripts or with bash, since bash interprets semicolcon as separating bash commands, etc. As for the particular errors, I am personally less familiar with using cygrunsrv ... Eliot Moss -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple