Hi there

I am trying to write a Java wrapper for some C libraries. I have
gotten most of it working except that I am not able to launch
programs from the C libaries.   I have a standard C-shared object
library where I define a function using 

        JNIEXPORT int JNICALL Java_API_Mypackage_myfunction 
        (JNIEnv *env, jobject theObj)
        {
                fprintf(stdout,"Entered myfunction ...");
                execv("/sbin/ifconfig",NULL);
                return(errno);
        }

which I then call from my java program by -
              API.Mypackage n = new API.Mypackage();
              int ret = n.myfunction();
              System.out.println(ret);

However, this method does not result in printing out the ethernet
interface information as it should if the program had executed the
"/sbin/ifconfig" program.  It just prints till the "Entered
myfunction..." part and then exits. ERRNO reports "number 2" which
is "no such file or directory" while I KNOW that it is there.

This is what I get -

     [amlan@catbert jwrapper]$ java TestTheWrapper
     Entered myfunction...
     2
     [amlan@catbert jwrapper]$

What am I doing wrong ??

Thanks in advance.

-amlan.

-- 
Amlan Saha                                       [EMAIL PROTECTED]
                                                [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to