• 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

Setting ojdbc14.jar as classpath.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 21
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
My pie came with a little toothpic holding up this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic