Strange “java.lang.NoClassDefFoundError” in Eclipse

早过忘川 提交于 2019-12-24 02:16:45

问题


i am testing a J2me project when i run it is giving java.lang.NoClassDefFoundError: org/cdac/securitycore/storage/StorageBridge. I had included a jar file which contains StorageBridge.class even i checked the class path also my jar file compiled at 1.5 compilence & my application is building with 1.3 compilence is this the reason for creating a problem


回答1:


Perhaps you did not include the .jar correctly. Right click on your project and go to Build Path->Configure Build Path->Add external .jar. Hope that helps.




回答2:


I had the same problem once. It took me hours to figure it out...

From what I remember, Eclipse kind of "has" 2 classpaths: a compile classpath and a runtime classpath. I don't remember where exactly to access both, but I'm pretty sure it's somewhere in the project's properties. Make sure that your JAR file is added to both of them.




回答3:


java.lang.NoClassDefFoundError: org/cdac/securitycore/storage/StorageBridge. I had included a jar file which contains StorageBridge.class

But did it contain it as org/cdac/securitycore/storage/StorageBridge.class? and does that class contain the statement package org.cdac.securitycore.storage;? Getting either of whose wrong will cause this exception.




回答4:


You should try adding the jars by to the classpath in the following TWO ways:

(you_project) > Properties > Java Build Path > Libraries > Add External JARs...

AND (This is what fixed it for me)

Run > External Tools > External Tools Configurations > Classpath > User Entries > Add External JARs...



来源:https://stackoverflow.com/questions/16454422/strange-java-lang-noclassdeffounderror-in-eclipse

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