ClassNotFoundException when including a library jar

不问归期 提交于 2019-12-04 06:52:20

You're getting a NoClassDefFoundError because your jar file is not available at runtime.

In order for it to be available at runtime you'll have to check the checkboxes on your jar file in your java build path like this:

Nitzan Tomer

Ok, I finally managed to find the problem, it took me a while.

I am using java 7 on my machine and the ant builder uses this default version as well, unfortunately though, android does not like java 7, and so this fixed the problem for me:

<javac srcdir="." destdir="bin/classes" source="1.6" target="1.6">
    ...
</java>

Or you can use these steps in Eclipse:

Eclipse menu: Window/Preferences/Java/Compiler
Compiler Compliance level: 1.6 
tick "use default" 

Hope that this will save some time for others who are facing this problem.

(java build path / order and export) move your lib on top and check in

For IntelliJ this setup finally made the error go away for me:

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