Strange “java.lang.NoClassDefFoundError” in Eclips

2019-07-23 22:51发布

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

标签: java java-me
4条回答
▲ chillily
2楼-- · 2019-07-23 23:18

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.

查看更多
Viruses.
3楼-- · 2019-07-23 23:23

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楼-- · 2019-07-23 23:25

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.

查看更多
看我几分像从前
5楼-- · 2019-07-23 23:32

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...

查看更多
登录 后发表回答