• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFound

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

in my workspace I have three projects:

-- XML Editor (downloaded from Eclipse CVS), extended by me and this is a plug-in
-- project A
-- Common

Common contains functions that can be used both in XML Editor both in project A.

Both in ProjectA both in XMLEditor I have edited the build path and added the source folder of Common;
when launching ProjectA I have no problem, but when launching XML Editor (this is a plug-in, as said) I got error "NoClassDefFoundError".

The fact is class I want to use is imported in my class in the usual way:

import common.blablablabla

and till here I have no problem.

Problem arises only when launching XML Editor.

Can someone help me?

Thanks
Marco
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do NOT add the source folder of another project, add the project.

If Project A depends on Project B, you could build the Project B and use the jar if you want but when developing it is faster to use the project reference.

HowTo:
Project->Build Path->Configure Build path:
[Tab] Projects
[BTN] Add : Select project.


 
Marco Rossi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ove Lindström wrote:Do NOT add the source folder of another project, add the project.

If Project A depends on Project B, you could build the Project B and use the jar if you want but when developing it is faster to use the project reference.

HowTo:
Project->Build Path->Configure Build path:
[Tab] Projects
[BTN] Add : Select project.




Sorry, my bad explanation.
I added the project B using BuildPath->Tag Project->Add, but it does not work.
I also tried adding the jar file...nothing changed, same error.

 
Ove Lindström
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Marco Rossi wrote:
Sorry, my bad explanation.
I added the project B using BuildPath->Tag Project->Add, but it does not work.
I also tried adding the jar file...nothing changed, same error.



Added what where? I think you are getting confused about who is depending on who.

Start by asking yourself this questions:
Where am I?
Do I have a pulse?
Where can I find what I need?
Have I added a dependency to that?
If I have, what is the accessor of that resource?

If Project A needs resources in Common, Project B needs to add Common to the build path. Not the other way around.
 
Marco Rossi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No!

ProjectA needs resources that are in ProjectCommon, so I added ProjectCommon to build path of ProjectA...but it does not work.

But probably I found why.
ProjectA is a plug-in, when I start it from inside Eclipse with "Run as Eclipse Application" another instance of Eclipse opens and a runtime workspace is created.
Probably do I have to add ProjectCommon to this workspace?
 
Ove Lindström
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Marco Rossi wrote:No!

ProjectA needs resources that are in ProjectCommon, so I added ProjectCommon to build path of ProjectA...but it does not work.

But probably I found why.
ProjectA is a plug-in, when I start it from inside Eclipse with "Run as Eclipse Application" another instance of Eclipse opens and a runtime workspace is created.
Probably do I have to add ProjectCommon to this workspace?



If Project A is a plugin, extending XMLEditor plugin, and you start the Project A, then you need to make sure that the OSGi/Equinox-instance also takes the XMLEditor-plugin when starting.

Build path is when you build and affects if you see the code during development. Such as code completion of depending classes and packages.

When in Runtime, then you need to make sure that your deployment descriptor has the dependencies declared. Two different things.

 
Marco Rossi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok!

When I start the plug-in as an Eclipse Application (from inside Eclipse) everything works fine, I have feature that I implemented and so on and so on.

During code writing I have code completion for classes that are inside ProjectCommon...but when I run my plug-in I get "NoClassDefFound"
 
reply
    Bookmark Topic Watch Topic
  • New Topic