title: Exception JNI (Ljava/lang/String;)Ljava/lang/String;
body: <p>I have made a little program in java that accepts a string as a user input. Now i have made a dll writing its code in Visual C++. when i run my program from netbeans it displays this exception.</p>
  
  <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: Prompt.getLine(Ljava/lang/String;)Ljava/lang/String;
          at Prompt.getLine(Native Method)
          at Prompt.main(Prompt.java:19)
  </code></pre>
  
  <p>What problem is this. Need Help. Thanks  </p>
  
  <p>This is java code</p>
  
  <pre><code>public class Prompt {
  
      /**
       * @param args the command line arguments
       */
      private native String getLine(String prompt);
      public static void main(String[] args) {
          // TODO code application logic here
          Prompt p = new Prompt();
          String input = p.getLine("Type a line:");
          System.out.println("User Typed:" + input);
      }
      static {
          System.loadLibrary("Prompt");
          //System.load("C:/Program Files/Java/jdk1.6.0/bin/Prompt.dll");
      }
  }
  </code></pre>
  
  <p>and this is C++ Code</p>
  
  <pre><code>#include "stdafx.h"
  #include "jni.h"
  #include "jni_md.h"
  
  JNIEXPORT jstring JNICALL Java_Prompt_getLine(JNIEnv *env, jobject obj, jstring prompt)
  {
      char buf[128];
      const char *str;
      str = env-&gt;GetStringUTFChars(prompt,0);
      if (str == NULL) {
          return NULL; /* OutOfMemoryError already thrown */
      }
      printf("%s", str);
      env-&gt;ReleaseStringUTFChars(prompt, str);
      /* We assume here that the user does not type more than
      * 127 characters */
      scanf("%s", buf);
      return env-&gt;NewStringUTF(buf);
  }
  </code></pre>