title: Java Virtual Machine Launcher : A JNI Error with Spring
body: <p>I use Windows10 Pro 32bit ENG, EclipseEE Mars, Java 8_66. If I want create a easy bean project with Spring and run it it show me a error in Windows dialog. When I enter this dialog it generated exception.</p>
  
  <pre><code>Java Virtual Machine Launcher - Error : 
  A JNI error has occurred, please check your installation and try it again.
  </code></pre>
  
  <p>I have in CLASSPATH : Apache *.jars</p>
  
  <pre><code>•commons-logging-1.2.jar
  •commons-logging-1.2-javadoc.jar
  </code></pre>
  
  <p>Spring *.jars </p>
  
  <pre><code>•spring-aop-4.1.5.RELEASE.jar
  •spring-beans-4.1.5.RELEASE.jar
  •spring-context-4.1.5.RELEASE.jar
  •spring-aspects-4.1.5.RELEASE.jar
  •spring-context-support-4.1.5.RELEASE.jar
  •spring-core-4.1.5.RELEASE.jar
  •spring-web-4.1.5.RELEASE.jar
  •spring-webmvc-4.1.5.RELEASE.jar
  •spring-expression-4.1.5.RELEASE.jar
  </code></pre>
  
  <p>I have the tested Java 8_60 vs Spring 4.1.5, Java 8_66 vs Spring 4.1.5 or 4.2.2.</p>
  
  <p>KlientMetaTest.java</p>
  
  <pre><code>package klient;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  import server.ServerVypis;
  public class KlientMetaTest {
      public static void main(String[] args) {
          @SuppressWarnings("resource")
          ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/Beans.xml");
          ServerVypis obj = (ServerVypis) context.getBean("mujSpring");                           //  id beanu
          obj.getMessage();   
      }
  }
  </code></pre>
  
  <p>ServerVypis.java</p>
  
  <pre><code>package server;
  public class ServerVypis {
      private String message;
      public void setMessage(String message){
          this.message = message; }
      public void getMessage(){
          System.out.println("Zde je tvuj Spring vypis  : " + message);   }
  }
  </code></pre>
  
  <p>beans.xml which is in /META-INF/ folder</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
     &lt;bean id="mujSpring" class="server.ServerVypis"&gt;
         &lt;property name="message" value="Vypis z \META-INF\Bean.xml"/&gt;
     &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Exception which was showing in console :</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
      at java.lang.Class.privateGetMethodRecursive(Unknown Source)
      at java.lang.Class.getMethod0(Unknown Source)
      at java.lang.Class.getMethod(Unknown Source)
      at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
      at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
  Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 7 more
  </code></pre>