• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

External JARs in Eclipse problem

 
mandeep saikia
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,

I am Java newbie..

I have been struggling to use one of the JDBC APIs (Jackcess) for connecting to a MS Access DB.

I downloaded the JARs and added them under referenced libraries ( Build Path --> Add External Archives ). However, during runtime I am getting all errors-- the error log in eclipse is under ::-

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/builder/StandardToStringStyle
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.healthmarketscience.jackcess.impl.ColumnImpl$SortOrder.toString(ColumnImpl.java:2215)
at java.lang.String.valueOf(String.java:2979)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at com.healthmarketscience.jackcess.impl.IndexData.newColumnDescriptor(IndexData.java:1303)
at com.healthmarketscience.jackcess.impl.IndexData.read(IndexData.java:435)
at com.healthmarketscience.jackcess.impl.TableImpl.readIndexDefinitions(TableImpl.java:1342)
at com.healthmarketscience.jackcess.impl.TableImpl.<init>(TableImpl.java:261)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.readTable(DatabaseImpl.java:1437)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.readSystemCatalog(DatabaseImpl.java:800)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.<init>(DatabaseImpl.java:517)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java:390)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:170)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:193)
at javajdbc.Jdbc1.main(Jdbc1.java:19)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.builder.StandardToStringStyle
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Thanks in advance.

Regards,

Mandeep
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, clearly the jar file containing that class isn't in the classpath at runtime. Whether this has anything to do with Eclipse or not depends on how you are running your application. By the way, which jar is the one containing that class?
 
Ron McLeod
Bartender
Pie
Posts: 943
59
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this the same as this topic ClassNotFoundException in sun.jdbc.odbc.JdbcOdbcDriver?
 
mandeep saikia
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir,

I posted a query regarding JDBC drivers ...however, it seems (on trying to use a pure java connection API) the problem is with the eclipse runtime path?

I have just downloaded the JAR files and added them to the referenced libraries in my project...I have added ALL the JAR files (including dependencies) to the build path. What else is required to be done?

Please help!!

Thanks again,

Mandeep
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevertheless, if you're getting that message then it means that the class named in the message isn't in the classpath. Which, assuming that you're running that code from within Eclipse (I asked you that but you didn't respond), would be the build path. In which case the jar file containing that class isn't in your build path.

So let me ask you again: Which jar is it which contains that class? Once you answer that you'll have a better idea of what you should do.
 
mandeep saikia
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir,

The Jackcess API uses dependencies -- apache commons-lang and apache commons -logging.

The classes for Jackcess are present in jackcess-2.0.4.jar

The classes for the commons -lang are in commons-lang3-3.3.2.jar

The classes for commons-logging are in commons-logging-1.1.3.jar, etc.

I have added all these JARs in the buildpath (referenced Libraries in eclipse). Also, in my windows OS, I have set the classpath system variable and added all of of them. Still getting the log mentioned before --

Please help Sir !!

Thanks in advance.

Regards,

Mandeep
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic