Monday, 15 September 2014

how to run a c program using a java program using JNI -


I have browsed the whole internet and I am stuck in the shared library right now. First Java File:

  Import java.io. *; Public class JavaToC {public resident zero hello (c); Stable {System.loadLibrary ("HelloWald"); } Public static zero main (string [] args) {new jaataatao (). Hello C (); }}  

After compiling the Java program above, I have also used the header file:

  Java javascript  

I have now written my simple program: (HelloWiredDom.com)

  #include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; # Include & lt; JavaToC.h & gt; # Include & lt; Jni.h & gt; JNIEXPORT void JNICALL Java_JavaToC_helloC (JNIEnv * env, Jobseekabawojo) {printf ("Hello World: from C"); Return; }  

Now I wanted to create a native shade library, but here I was stuck, I

  GCC Helloowald.C: IC: \ program Files \ Java \ jdk1.7.0_21 \ include - IC: \ Program Files \ Java \ jdk1.7.0_21 \ include \ win3 -shared -o HelloWorld.dll  

But in the Window these commands After inserting, this error returns:

  gcc: error: files \ java \ jdk1.7.0_21 \ include: such a file or directory is not GCC: Error: files \ Java \ Jdk1 7.0_21 \ include \ Win3: Any such file or directory  

I'm unable to clear it! : You can use SWIG (see) to create a Java API wrapper at the top of your C code: ((

You just need to write the swing interface file, which is used by swig to generate suitable sections and appropriate files for their inherent methods.

In your current view, The problem is facing you because you need to avoid space. Put quotation marks around the program file.


No comments:

Post a Comment