开发者

NoClassDefFoundError importing a library project

开发者 https://www.devze.com 2023-01-06 21:49 出处:网络
I\'m currently writing a unit test project using the version 4.6.1 (Windows Vista + Eclipse). My project is div开发者_如何学Pythonided in 3 part:

I'm currently writing a unit test project using the version 4.6.1 (Windows Vista + Eclipse). My project is div开发者_如何学Pythonided in 3 part:

  • A. Unit test application (type:CLDC application)
  • B. Application to be tested (type:CLDC application)
  • C. A library project (type: library,no .jar file imported)

The A project should reference the code present in B (and of course even in C). I would like to specify that I can run without problems the project B (referencing C). My problems start when I try to run the project A.

I performed the following operations:

changing the B project type from CLDC application to library B references the project C A references the project B set all project as "Active for Blackberry" Basically A sees the two other project as two nested libraries. The code is built successfully,but the problem is that when a class of the C library is called by B during the execution, the following exception is thrown:

NoClassDefFoundError

No detail message

Any help would be really appreciated.

Many Thanks


A NoClassDefFoundError means that A cannot find C at runtime. The usual cause is that C failed to be deployed onto the target device (simulator or real device).

Solution 1:

For project A under Project->Properties->Java Build Path ensure C (your library project) is listed under 'Projects' and the corresponding checkbox checked on the 'Order and export' tab. This should ensure that the library is exported during the build and deployment process.

Solution 2:

In project A add a symbolic link (right click project->Build Path->Link Source) to the library C source. This will force the library's source code to be included when project A is built.

0

精彩评论

暂无评论...
验证码 换一张
取 消