• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

External JARs in Eclipse problem

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 4510
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic