This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes ClassNotFoundException after setting env variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ClassNotFoundException after setting env variable" Watch "ClassNotFoundException after setting env variable" New topic
Author

ClassNotFoundException after setting env variable

Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
Hey all,

I was trying to execute a little bit of code


but it fails right there at the Class.forName. I read that I needed to set the CLASSPATH so I did, both for the system and for me the user...
classpath = .;C:\Program Files\Java\jre1.6.0_07\lib\ext\QTJava.zip;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\jars\classes12.jar

but I am still getting this exception. What else should I do?
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
So I ran this from the command line

java oracle.jbdc.driver.OracleDriver

and I got the classNotFoundException again so I am guessing that I don't have the variable set correctly but it appears to be. What else could I do. I am a windows machine and set the variable by going to properties of my computer and editing the classpath variable.

I have restarted (a couple of times)...
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

At the command prompt, type "SET". A bunch of environment variables will be shown. Please tell us what the CLASSPATH is there.


[My Blog]
All roads lead to JavaRanch
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
CLASSPATH=.;C:\jars\classes12.jar;C:\Program Files\Java\jre1.6.0_07\lib\ext\QTJava.zip;C:\Program Files\Java\jre6\lib\ext\QTJava.zip
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You have classes12.jar in C:\jars, right ?

I was trying to execute a little bit of code

How did you execute it ?
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
classes12 in the jar file? Yes. It is about 1500kb in size and is there.

Tried running it from jdeveloper-I haven't used jdeveloper in years so it could be that there is something to set up that I don't know about. I am trying to research that now.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Pat Peg wrote:Tried running it from jdeveloper

Now that's a different problem. JDeveloper is probably not using your environment variable. I think you have to configure the libraries used by your program in JDeveloper. Something like this ?
Pat Peg
Ranch Hand

Joined: Feb 04, 2005
Posts: 194
Cool-thank you. I am reading it now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassNotFoundException after setting env variable
 
Similar Threads
I can compile but can't run
Still cant complile servlet after setting classpath
7 errors for beersong source code in HFJ
weblogic can't start with this message
Unable to import