On Thu, 19 Aug 1999, Amlan Saha wrote:
> Hi there
>
> This is what I am doing inside a "libmylib.so" which I am loading from
> a java app. The problem is that the two lines "execl" and "system"
> refuses to take effect. It correctly executes all the other parts
> like the "fprintf" statements. Is there somekind of a limitation
> that "system" calls and "exec" group of calls do not work when using
> a java wrapper over a shared object C library ?
>
> if ((pid = fork()) <0 ) {
> fprintf(stdout,"fork() error\n");
> } else if (pid == 0) {
> fprintf(stdout,"Inside the forked process\n");
> execl("/bin/sh","sh","-c","/sbin/ifconfig",(char *) 0);
> _exit(127);
> } else {
> system("/bin/ls");
> fprintf(stdout,"Reached the end\n");
> return(errno);
> }
>
> I declare the above function as "public native" in the java wrapping
> function which is called by the java app.
>
> Any help is appreciated.
Would it be possible to use java.lang.Runtime to execute the commands you
need? Or do you absolutely have to execute the commands inside native
methods? I think it's possible to examine the return values of the
commands, if that's needed.
Harri
Harri Sunila
Research assistant
Helsinki University of Technology
Telecommunications Software and Multimedia Laboratory
URL: http://www.tcm.hut.fi/~harri
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]