title: C++ calls Java-NoClassDefFoundError
body: <p>I can debug my java application on eclipse,everything seems OK.But when I used C++ to call the class and catch the exception,I got the error:</p>
  
  <pre><code> Exception in thread "main" java.lang.NoClassDefFoundError: ParserDemo/ParserNP 
  Caused by: java.lang.ClassNotFoundException: ParserDemo.ParserNP
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  </code></pre>
  
  <p>OS:Windows </p>
  
  <p>java version 1.8</p>
  
  <p>How can I fix it?
  Thanks :)</p>
  
  <p>edit:
  My c++ code:</p>
  
  <pre><code>    int res;                     
  JavaVMInitArgs vm_args;       
  JavaVMOption options[3];     
  JavaVM *jvm;           
  JNIEnv *env;                            
  
  options[0].optionString = "-Djava.compiler=NONE";  
  options[1].optionString ="-Djava.class.path=.";
  options[2].optionString = "-verbose:NONE"; 
  
  vm_args.version = JNI_VERSION_1_8;  
  vm_args.nOptions = 3;   
  vm_args.options = options;   
  vm_args.ignoreUnrecognized = JNI_TRUE;  
  
  typedef jint (WINAPI *PFunCreateJavaVM)(JavaVM **, void **, void *);  
  const wchar_t szJvmPath[]=L"C:\\Program Files (x86)\\Java\\jdk1.8.0_112\\jre\\bin\\client\\jvm.dll";
  
  HINSTANCE hInstance = ::LoadLibrary(szJvmPath);  
  
  if (hInstance == NULL)     
  {     
      cout&lt;&lt; "LoadLibrary False"&lt;&lt;endl;  
      cout&lt;&lt;::GetLastError()&lt;&lt;endl;  
      return -2;     
  }  
  PFunCreateJavaVM funCreateJavaVM = (PFunCreateJavaVM)::GetProcAddress(hInstance, "JNI_CreateJavaVM");  
  res = (*funCreateJavaVM)(&amp;jvm, (void**)&amp;env, &amp;vm_args); 
  if (res &lt; 0)  
  {  
      return -1; 
  }      jclass cls = env-&gt;FindClass("ParserDemo/ParserNP");
     jthrowable exc;
     exc=env-&gt;ExceptionOccurred();
  
  
  if(exc){
      jclass newExcCls;
      env-&gt;ExceptionDescribe();
      env-&gt;ExceptionClear();}
  </code></pre>