Cannot reference jdbc.SQLServerDriver in Eclipse (ClassNotFoundException)

放肆的年华 提交于 2019-12-05 21:35:46

Under the Run -> Run Configurations menu item you should find an entry for a Java application with the same name as the class that contains your main() method.

Have a look at the classpath tab. You should find your project listed under user entries. Expand it and see if the Microsoft JDBC Jar is listed.

The class path you use for compilation need not be the same as you choose for runtime, though Eclipse usually mirrors any changes to your build path to any launch configurations.

Your spelling and case for the package and class names look correct (Java is case-sensitive on names).

And yes, learning Java and Eclipse will take effort - Eclipse is quite different from other IDEs and it takes time to get to know it.

I found the answer here: http://code.google.com/p/android/issues/detail?id=27490 Seems like includes under Referenced Libraries is not available at runtime and I couldn't see how to change this in my version of Eclipse

" Reported by fred...@mobileinteraction.se, Mar 22, 2012 Host OS: Windows 7 x64 SDK tools version: 17 Eclipse version: 3.7.2 ADT plug-in version:17.0.0v201203161636-291853 Platform targeted by your project: 2,2 Version of the platform running in the emulator: 2.2

STEPS TO REPRODUCE: 1. Create a project that uses external jars (in my case android-support-v4.jar ). 2. Added the android-support-v4.jar using Properties - Java Build Path - Add External Jar. Have the Activity extends from FragmentActivity. 3. Clean and run project

EXPECTED RESULTS: Application would run launching the FragmentActivity

OBSERVED RESULTS: Application crashes, android-support-v4.jar is placed within "References Libraries" and thus Android can't find it at runtime.

SOLUTION: Manualy create a folder /libs within your project, copy the android-support-v4.jar to that folder and the ADT will place it under 'Android Dependencies' and it works.

This is the case for all external jars added using Properties - Java Build Path - Add External Jar.

"

augus1990

Adding the JDBC driver of MS SQL Server to Eclipse:

  1. Download the JDBC driver and uncompress it
  2. Secondary click in the root of the Eclipse project and go to "Properties".
  3. Now go to the section "Java Build Path - Libreries" y then click "Add External JARs".
  4. Search the "sqljdbc.jar" file in the directory where you unpacked the downloaded driver, double click y finish pressing "ok".

I faced the problem and then solved the issue i.e. If You are using the Tomcat as a server for your Web application, the same Exception was coming as the Driver was unavailable to the project, later I put the jar file (sqljdbc4-2.0.jar) into the WEB-INF/lib folder then it was working

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