Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to load the JDBC driver

 
Nirmal Mukundan
Ranch Hand
Posts: 37
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I was trying to execute a java file from Unix. I am using a JDBC connection in this program.


Code:
XXXXX/test/nirmal/Java > ls -lrt

drwxrwxrwx 3 ideasm10 ide 3 Jul 7 11:01 classes
drwxrwxrwx 3 ideasm10 ide 3 Jul 7 11:01 src
drwxrwxrwx 2 ideasm10 ide 3 Jul 7 11:47 lib
-rw-r--r-- 1 ideasm10 ide 71 Jul 7 13:01 sysout.log

From here I give the when I give the command


Code:
java -cp classes com/test/jdbc/InvalidNumberTest
I am getting java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver.

Then I placed the ojdbc14.jar in the lib abd then executed the command


Code:
java -cp classes;lib/ojdbc14.jar com/test/jdbc/InvalidNumberTest
Now I am getting the exception


Code:
Failed to load Main-Class manifest attribute from
lib/ojdbc14.jar.
Can some one please help me to execute the java file.

The same program can be executed from Windows using the same commnds.

Also can you please provide a .sh file wher I can set the classpaths and also execute the java program.

Thanks
Nirmal
 
Paul Clapham
Sheriff
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use colons, not semicolons, to separate entries in your classpath on a Unix system.
 
Nirmal Mukundan
Ranch Hand
Posts: 37
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not understand. Where are you asking to use the colons. Since I did not use any export command ...
 
Paul Clapham
Sheriff
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Use colons, not semicolons, to separate entries in your classpath on a Unix system.


What I meant by that was to use them in your classpath. That's why I used those words. Do you not see where you set your classpath? Let me point it out more precisely:
java -cp classes;lib/ojdbc14.jar com/test/jdbc/InvalidNumberTest
 
Nirmal Mukundan
Ranch Hand
Posts: 37
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops ..sorry..I didnt not recognize that..thanks for the quick solution..

I also wanted to know if there is any chat available so as to get expertise on issues quickly?
 
Paul Clapham
Sheriff
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't one here. There might be one somewhere else, but I expect if you want experts standing by to answer your questions in real time you might have to pay real money for that.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nirmal Mukundan wrote:I also wanted to know if there is any chat available so as to get expertise on issues quickly?

You got an answer in under an hour. That's pretty quick!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic