本帖最后由 eternallove 于 2014-5-1 20:04 编辑
- public class InputSpectorTest {
- public static void main(String[] args){
- JavaBeanTest jbt = new JavaBeanTest(3,4);
- BeanUtils.setProperty(jbt, "birthday.time", "111");
- BeanUtils.setProperty(jbt, "birthday.time", "111"); System.out.println(BeanUtils.getProperty(jbt, "brithday.time"));
- }
- }
- import java.util.Date;
- public class JavaBeanTest {
- private Date birthday = new Date();
- private int x;
- private int y;
- public Date getBirthday() {
- return birthday;
- }
- public void setBirthday(Date birthday) {
- this.birthday = birthday;
- }
- public JavaBeanTest(int x,int y){
- 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;
- }
- }
复制代码
哥们都帮忙看看,我这个代码为什么会有异常:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap
at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:959)
at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1254)
at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:790)
at org.apache.commons.beanutils.BeanUtilsBean.getNestedProperty(BeanUtilsBean.java:709)
at org.apache.commons.beanutils.BeanUtilsBean.getProperty(BeanUtilsBean.java:735)
at org.apache.commons.beanutils.BeanUtils.getProperty(BeanUtils.java:380)
at com.xy.test.InputSpectorTest.main(InputSpectorTest.java:66)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.FastHashMap
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 7 more
|
|