问题
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?
回答1:
Sure, just set your JRE to the proper Java6 one, instead of relying on Eclipse's autoconfig.
Yes, I'm talking to myself.
回答2:
Try to add the jar as command line argument in Run dialog.
回答3:
That is not how I normally add jars to an eclipse project. Try following the steps in this Wiki.
来源:https://stackoverflow.com/questions/819087/eclipse-and-classpath