我是春天和maven的新手.我有一个使用Spring的简单hello world项目.项目构建成功但我在运行时遇到以下错误:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
Run Code Online (Sandbox Code Playgroud)
这是主要的应用程序:App.java
package com.test.SpringMaven2;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
System.out.println( "Hello World!" );
ApplicationContext context = new AnnotationConfigApplicationContext(HelloWorldConfig.class);
HelloWorld hello = (HelloWorld) context.getBean("helloWorld");
hello.setName("Adnan");
hello.getName();
}
}
Run Code Online (Sandbox Code Playgroud)
这是HelloWorld bean
package com.test.SpringMaven2;
public class HelloWorld{
private String name;
public void …Run Code Online (Sandbox Code Playgroud)