本帖最后由 银酱 于 2014-3-4 22:35 编辑
异常
java.lang.NoClassDefFoundError: cn/itcast/day1/BeanUtilsDemo
Caused by: java.lang.ClassNotFoundException: cn.itcast.day1.BeanUtilsDemo
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Exception in thread "main"
代码:
Point类
package cn.itcast.day1;
public class Point {
private int x;
private int y;
public Point(){
}
public Point(int x, int y) {
super();
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
测试代码:
package cn.itcast.day1;
import org.apache.commons.beanutils.BeanUtils;
public class BeanUtilsDemo {
public static void main(String [] args)throws Exception{
Point pt=new Point(1,2);
System.out.println(BeanUtils.getProperty(pt, "x"));
}
}
包都导入了一个228K 一个61K的,为什么会出现这个问题额。。:Q
|