permaculture playing cards
The moose likes Beginning Java and the fly likes PATH Vs. CLASSPATH settings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "PATH Vs. CLASSPATH settings" Watch "PATH Vs. CLASSPATH settings" New topic


Richa Jeetah

Joined: Sep 27, 2001
Posts: 29
How is Path differnt from classpath settings...
do they conflict in any way?
i am trying to run a java program which tries to load jdbc driver
my path is set to: PATH=h:\jdk1.3.1_01\bin
and classpath to:
set CLASSPATH=K:\oracle\ora90\jdbc\lib\;K:\oracle\ora90\jdbc\lib\
if i am right assuming that my dreiver are in :
note oracle is in K: drive and my jdk in H: drive
when i do not set the classpath and run a simple program which outputs a srting it runs alright...BUT... when i set the classpath var my program does not run, tough it compiles fine...
it gives following error on running:
Exception in thread "main" java.lang.NoClassDefFoundError:simpleprogram
but if i do not set the classpath ... simple porgrams run fine but the jdbc programs give couple of other errors.... saying no such pacages oracle.jdbc.driver.*
I am very confused!
please help !!
[ March 13, 2002: Message edited by: Richa Jeetah ]
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
This might be of some help:
BTW, is also one of the files I needed in my classpath so my batch files specify this:
set CLASSPATH=%CLASSPATH%;.\lib\log4j-1.2beta4.jar
Of course just change the path to your zips and jars.
Path is where you can specify a directory containing executables (exe, com, bat, etc) and not have to put the full path to them on the command line. It's kind of like the import in Java. If you import a package, you can simply reference a class within the package as opposed to the fully qualified class name. Likewise, if you specifiy a Path to javac.exe you can simply type:
C:\>javac instead of
[ March 13, 2002: Message edited by: David Duran ]
I agree. Here's the link:
subject: PATH Vs. CLASSPATH settings
It's not a secret anymore!