• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting ojdbc14.jar as classpath.

 
Willhelm Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

Got a question surrounding classpaths.

I have created a program that depends on the oracle JDBC driver, I have built it in Eclipse and added ojdbc14.jar to the build path. However when I want to run it from the command prompt it says it can’t find the oracledatasource (due to it not being in the classpath).

How do I add the ojdbc14.jar to the classpath on the command line so my runnable jar will work?

I have tried SET CLASSPATH=<dir> and when I type Set Classpath it actually comes up with the ojdbc.jar file however it still doesn’t run.

Cheers

Will
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be of some help. If you want to make your Jar runnable, you will need to set the Class-Path in the jar's manifest file.
 
Willhelm Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:This might be of some help. If you want to make your Jar runnable, you will need to set the Class-Path in the jar's manifest file.


Ok, but I want to be able to set the classpath from the command line so other users can set the classpath of their ojdbc14.jar file.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean set it from your Java program?
 
Willhelm Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:Do you mean set it from your Java program?


No I mean set it from the command prompt (as in Windows CMD). Basically my program relies on this ojbc14.jar file in order to compare databases. The idea is other users can download the ojdbc14.jar file from the oracle website, add this to the classpath from wherever they have it locally and run my program.
 
Nikhil Pasupukuntla
Greenhorn
Posts: 21
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Willll,

In the set classpath=<dir>. Does your dir include jar file name as well? If not try including the jar file name in the path for e.g; set classpath ="c:/example/ojdbc1.4jar"
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think if you create a simple Ant build file and use build.bat to run your program, you can give your users chance to setup the JAR file path conveniently.

regds,
amit
 
Willhelm Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nikhil pasupukuntla wrote:Willll,

In the set classpath=<dir>. Does your dir include jar file name as well? If not try including the jar file name in the path for e.g; set classpath ="c:/example/ojdbc1.4jar"


Ok its a new day, I was doing this "set classpath =c:/example/ojdbc1.4jar" yesterday and it wasnt working, I thought I would give it a try again and it seems fine, weird! Anyways it is working now.

Thanks for the help guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic