2

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

user2307155
  • 185
  • 1
  • 3
  • 12
  • please add some code, that would be great and we can advice you then..!! – akki0996 May 09 '13 at 04:35
  • java.lang.NoClassDefFoundError: org/cdac/securitycore/storage/StorageBridge at com.sun.midp.midlet.MIDletState.createMIDlet(+29) at com.sun.midp.midlet.Scheduler.schedule(+52) at com.sun.midp.main.Main.runLocalClass(+28) at com.sun.midp.main.Main.main(+80) Execution completed. 3401700 bytecodes executed 26 thread switches 1668 classes in the system (including system classes) 17641 dynamic objects allocated (532072 bytes) 3 garbage collections (455896 bytes collected) – user2307155 May 09 '13 at 04:40

4 Answers4

2

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.

Steve P.
  • 14,489
  • 8
  • 42
  • 72
  • my jar file was compiled at 1.5 compilence & my application was build with 1.3 compilence – user2307155 May 09 '13 at 04:58
  • The source and target levels are complelely irrelevant to this problem, unless there is more to the stack trace than you have revealed so far. – user207421 May 09 '13 at 05:06
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.

Radu Murzea
  • 10,724
  • 10
  • 47
  • 69
1

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • yes StorageBridge.class is present in jar file class also contains the package my new doubt is that my jar file was compiled at 1.5 compilence & my application was build with 1.3 compilence wether it would be the problem – user2307155 May 09 '13 at 05:09
  • Just repeating that it is 'present' doesn't tell us anything. You haven't clarified whether both the conditions I specified are met. If it was a 1.5/1.3 problem you would get a different exception. – user207421 May 09 '13 at 05:25
  • yes sir my jar contains org/cdac/securitycore/storageBridge.class and StorageBridge.java contains package org.cdac.securitycore.storage – user2307155 May 09 '13 at 06:13
  • If what you say is true you have an uppercase/lowercase problem. I suggest you build the SR file using your DE or Maven or Ant or something that knows how to do it correctly, – user207421 May 09 '13 at 13:00
1

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

Ian2thedv
  • 2,691
  • 2
  • 26
  • 47