Classpath is set as:
C:\Program Files\Java\jdk1.6.0\bin;C:\Program Files\Java\jdk1.6.0\lib;C:\Program Files\Java\jdk1.6.0\lib\tools.jar;.;C:\Program Files\Java\jdk1.6.0\lib\dt.jar;C:\MySQL\Connector-Java\debug\mysql-connector-java-5.0.5-bin-g.jar
BUT
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
> Classpath is set as:
How do you know?
You can always verify a class path.
1. Open a console window.
2. Run the following command.
java -cp <something> <MyClass>
If it does not find MyClass it will return a class not found exception. In that case there is always something wrong with the class path.
You might note that at least in the past the Sun VM just stopped looking if there were absolutely any errors at all in the class path. So for example if there is any problem at all with dt.jar (in your posted path) then it will never get to the last jar.
I was suggesting a simple method to determine if the class path you have by itself provides the jdbc driver.
That simple method allows you to diagnose class path problems outside of code.
What you want to type is the class path that you already provided (the one with dt.jar) and the class that you are already missing(com.mysql.jdbc.Driver)
And you did not specify how you determined what the class path was.
> It seems everything is right in the class path, so
> what is wrong?
I posted a method for you to determine exactly (not guessing) if there are problems or not.
1. Please post the exact command that you used based on the method that I presented and the exact output you got based on running that command.
2. You posted a class path above. Please post the exact way that you determined what that class path was. (I do NOT want to know how you created it - I want to know how you know that the above is the class path you are using.)
> >You might note that at least in the past the Sun VM
> just stopped looking if there were absolutely any
> errors at all in the class path.
>
> So it means that once jvm encounter the first .jar in
> classpath it will ignore the other .jar because ther
> are considered as lower priority?
Error means error. Finding a jar is not an error. Not finding a jar is an error.