views:

250

answers:

3

I swear I'm going insane.

JDeveloper runs my project with not a single complaint.

If I do "java -cp /usr/share/java/mysql.jar:. MAIN.java", it works like a charm.

But Eclipse says "[censored] you" and ignores my classpath settings.

I open the Run > Run... menu, and add the mysql jar in the classpath tab, but time and time again, I keep getting "No suitable driver found".

Now, I shouldn't have to add the jar to the build path ---otherwise, what's the point of using JDBC if I'm gonna rebuild if I wanna change the engine---. Nor should I have to do "Class.forName()", which I don't need in the other ways to run it.

A hand, in this insanity?

+2  A: 

Sure, just set your JRE to the proper Java6 one, instead of relying on Eclipse's autoconfig.

Yes, I'm talking to myself.

Tordek
A: 

Try to add the jar as command line argument in Run dialog.

Chathuranga Chandrasekara
A: 

That is not how I normally add jars to an eclipse project. Try following the steps in this Wiki.

willcodejavaforfood
Why whould I add it to the build path, if I'm not building MySQL into my app?
Tordek
The build path is also used as the runtime classpath. You can alternatively add it in a launcher definition (and save that definition with the project if you want to share it -- see the "common" tab of the launcher config)
Scott Stanchfield