java.lang.IncompatibleClassChangeError:找到类com.mysql.jdbc.Statement,但是需要接口 [英] java.lang.IncompatibleClassChangeError: Found class com.mysql.jdbc.Statement, but interface was expected
本文介绍了java.lang.IncompatibleClassChangeError:找到类com.mysql.jdbc.Statement,但是需要接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当SQL出现此异常时
java.lang.IncompatibleClassChangeError: Found class com.mysql.jdbc.Statement, but interface was expected
您能解释一下吗?是由于mysql jar更改为下一版本而引起的吗?
Can you please explain ? does it come due to mysql jar changes to next version ?
推荐答案
在mysql-connecter-java-5.0中,Statement是一个类。在5.1中,它是一个界面。
In mysql-connecter-java-5.0 Statement is a class. in 5.1, it's an interface.
您编写的代码不太在乎。但是,如果您针对新版本进行编译,然后针对旧版本运行,则会遇到此问题。
The code you write shouldn't care too much. But if you compile against the new version, then run against the old version, you'll have this problem.
这篇关于java.lang.IncompatibleClassChangeError:找到类com.mysql.jdbc.Statement,但是需要接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文