作为 zip 下载的 Ksoap 会导致 java.lang.NoClassDefFoundError
我已经下载了 ksoap2-android-assemble-2.5.4-jar-with-dependencies 其中 以 zip 文件形式下载。
当我将其添加到我的项目时,我收到 java.lang.NoClassDefFoundError。 如何将其添加为 jar 文件?
10 倍 &有一个美好的周末
I have downloaded ksoap2-android-assembly-2.5.4-jar-with-dependencies which
was downloaded as zip file.
When I add it to my project I get java.lang.NoClassDefFoundError.
How can I add It as a jar file?
10x & have a good weekend
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我真的建议你研究一下maven,并使用maven来获取ksoap2。设置 Maven 需要一些工作,但非常值得!
I really recommend that you look into maven, and use maven to get ksoap2. It's a bit of work getting maven set up, but well worth it!
你把它解压到某个目录了吗?如果是这样,右键单击项目名称,单击属性,Java 构建路径,添加外部 Jar 假设您使用的是 Eclipse
Have you unzipped it into some directory? If so, RightClick on project name, click properties, Java Build Path, Add External Jar assuming you are using Eclipse
java -jar
jarfilename
……(当您的“可执行文件”位于 jarfile 中但您可能希望 jarfile 位于您的类路径中
时使用此选项java -classpath
jarfilename
......java -cp
jarfilename
java -jar
jarfilename
...... (this is used when your 'executable' is in the jarfilebut what you probably want is for the jarfile to be in your classpath
java -classpath
jarfilename
......java -cp
jarfilename
将扩展名从 zip 更改为 jar
您下载了文件并在“保存到”位置时更改了扩展名
change extension from zip to jar
you downloaded the file and changed the extension when you "saved to" location
按照 wiki 上的下载说明进行操作即可。不过,真的要遵循。
右键单击“查看原始文件”。更多信息请访问
http://code.google.com/p/ksoap2 -android/wiki/HowToUse?tm=2
Follow the download instruction on the wiki and it will work. Really follow then though.
Right click on View Raw File. More at
http://code.google.com/p/ksoap2-android/wiki/HowToUse?tm=2
等外部 jar
结果是将ksoap2-android- assembly-2.6.2-jar-with-dependency.jar
放在 /libs 文件夹下,以便 Eclipse ADT 自动将您的 jar 添加到应用程序的构建路径中。毕竟这是一个构建路径缺少定义的类错误..我希望这也能帮助您!
在这里解决!!
Turns out external jars such as
ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar
to be put under /libs folder so Eclipse ADT automatically adds your jars to the buildpath of your application. It was a buildpath missing defined class error after all.. I hope this will help you, too!
Solved here!!