• Post Reply Bookmark Topic Watch Topic
  • New Topic

jar won't run outside of IDE: Throws exception: java.lang.NoClassDefFoundError: oracle/jdbc/OracleDr  RSS feed

 
Matthew Matthew
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, basically, I need to be able to distribute my newly created java project for beta testing. I developed a console application in NetBeans that accesses a remote oracle 10i DB. The first thing I did when I built this (having never written software that connects to a database in my life) was to research how its done, download ojdbc6 drivers and place them in: Java\jdk1.6.0_06\jre\lib\ext. When I created my database connection objects and tested them, they worked fine. All throughout development of this application, I had no problems connecting to the intended database. So now, when I try to run the jar file located in: My project's /dist directory, I run: and without fail receive the following exception:
Research into this implied that I need to manually put the drivers somewhere (?) I investigated adding a CLASSPATH variable from the coderanch article: but my oracle drivers are already placed in the default dirctory.
I can poll, query, insert, update realtime data when I test or debug, how can I bundle the required libraries for actual distribution? Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37469
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Matthew wrote:I can poll, query, insert, update realtime data when I test or debug, how can I bundle the required libraries for actual distribution? Thanks!

A jar in the classpath is better than using the ext library because it is less intrusive on the user's system.

As far as distribution, can you give your users a zip file containing a driver, your jar and a "bat" file to kick off the whole thing?
 
Matthew Matthew
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,
That sounds good. I did add a path to the jdbc as a $CLASSPATH variable but I still get the same exception. Am I misunderstanding some basic concept of jar creation? The directions on this site are slightly different than what I did. I generated a jar (and subsequently a JNLP launcher) via Net Beans IDE, the platform I developed this project on (It relies heavily on Swing for GUI components)

So what I really meant to say with:
how can I bundle the required libraries for actual distribution?
Actually should read: How can I bundle the libraries with the executable So I no longer recieve this exception and I will be able to distribute ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37469
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good question. I think this is more about packaging than JDBC and am going to move it to a more general forum. That way someone is more likely to know the answer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!