ClassNotFoundException:net.sourceforge.jtds.jdbc.Driver [英] ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver

查看:151
本文介绍了ClassNotFoundException:net.sourceforge.jtds.jdbc.Driver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有java代码连接到MS-SQL数据库并获取一些数据。

I have java code which connects to a MS-SQL database and procures some data.

在运行代码之前,我在Unix服务器中设置了类路径以前工作正常。

Before running the code I set the class path in the Unix Server and it used to work fine.

但由于某种原因,几天前工作的同一个jar文件抛出了一个Class not found异常 java.lang.ClassNotFoundException :net.sourceforge.jtds.jdbc.Driver

But for some reason the same jar file which was working a few days back is throwing a Class not found exception java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver

我没有jar jar文件,发现我正在加载的驱动程序类:

I have un-jared the jar file and found that the driver class which I'm loading :

Class.forName("net.sourceforge.jtds.jdbc.Driver");

出现在指定的包结构中。

is present in the specified package structure.

我不明白这是怎么回事。

I don't understand how this is happening.

任何人都可以提出解决此问题的建议。

Can anyone suggest any tips to resolve this.

推荐答案

java.lang.ClassNotFoundException 的问题可能是几个原因的结果:

The issue of java.lang.ClassNotFoundException might be the outcome of several reasons:


  • Jar文件在类路径中不可用。 (这不是你的情况。正如你提到的
    )。

  • Jar file is not available in class path. (This is not your case. as you have mentioned).

你的jar文件已损坏。

Your jar file is corrupted.

当前用户无法访问您的环境变量值。
(管理员撤销权限)。

Your environment variable value is not accessible by current user. (Permission revoked by administrator).

当前用户无权读取jar文件。

Current user don't have permission to read jar file.

请核实最后三个选项。

这篇关于ClassNotFoundException:net.sourceforge.jtds.jdbc.Driver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆