Eclipse and Classpath

心已入冬 提交于 2019-12-14 03:23:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!