抛出java.lang.ClassNotFoundException:net.sourceforge.jtds.jdbc.Driver在Android上 [英] Java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver On Android
问题描述
今天我使用 JTDS
司机做 SqlServer的
的连通性。但是,当我运行程序
我发现下面的错误
Today I am doing Connectivity of SqlServer
using JTDS
driver. But when I run program
I found Below error
Java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
Caused by: java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver in loader dalvik.system.PathClassLoader[/data/app/com.kmkm.lll-2.apk]
我对这个话题已经搜索,我发现答案
I already search on this topic and I found answer as
java -classpath .:jtds.jar MyApp
但我搞不清如何以及在何处运行此命令? 为什么这样的错误来?
but I am confuse how and where I run this command? Why this error comes?
推荐答案
我有同样的问题,我在Eclipse的Android应用程序。什么工作对我来说是出口的外部罐用我的应用程序。
I had the same problem with my Android app in Eclipse. What worked for me was to export the external jars with my app.
如果您已经添加了JTDS-1.2.5驱动程序,不错。否则:
If you have already added the jtds-1.2.5 driver, good. Otherwise:
右键单击项目>属性> 库标签 添加JTDS-1.2.5.jar文件,点击添加外部JAR
Right click on the Project > Properties > Libraries Tab Add the jtds-1.2.5.jar file by clicking on "Add External JARs"
接下来,在订单和出口标签(右旁的库在Java构建路径窗)检查框的 JTDS-1.2.5。罐的(以及任何其他外部罐子,你可能有)。
Next, in the Order and Export tab (Right next to Libraries in the Java Build Path window) check the box for jtds-1.2.5.jar (and any other external jars you might have).
这将导出包含与.apk文件文件中的驱动程序的.jar。
This will export the .jar containing the driver with the .apk file.
这篇关于抛出java.lang.ClassNotFoundException:net.sourceforge.jtds.jdbc.Driver在Android上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!