我在官网上扒的例子
为什么会报异常呢
例子入下:
- Java code
// Get a list of java.io.File objects. List myObjs = new ArrayList(); // Create a new Query. Query q = new Query(); // Execute the query. QueryResults qr = null; try { // Parse the SQL you are going to use. q.parse("SELECT name,length FROM java.io.File WHERE name LIKE '%.java'"); qr = q.execute(myObjs); } catch (QueryParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (QueryExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Cycle over the query results. List res = qr.getResults(); System.out.println(res.size()); for (int i = 0; i < res.size(); i++) { // Do something with the File. }
异常信息:
java.lang.NoClassDefFoundError: com/gentlyweb/utils/Getter
at org.josql.expressions.Accessor.init(Accessor.java:55)
at org.josql.expressions.SelectItemExpression.init(SelectItemExpression.java:71)
at org.josql.Query.initSelect(Query.java:2485)
at org.josql.Query.init(Query.java:2410)
at org.josql.Query.parse(Query.java:2337)
at jUnit.TestUnit2.testJoSQL02(TestUnit2.java:110)
at jUnit.TestUnit2.testUnit01(TestUnit2.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: com.gentlyweb.utils.Getter
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 27 more
这是什么原因呢 希望哪位大侠慷慨解囊 给小弟个例子或者一些资料 最好是中文的