Home » Eclipse Projects » Rich Client Platform (RCP) » Solution to java.lang.NoClassDefFoundError with RCP
Solution to java.lang.NoClassDefFoundError with RCP [message #461388] |
Wed, 10 January 2007 06:36  |
Eclipse User |
|
|
|
Hi all,
I struggled through what seemed to be a very basic issue; when I include
external libraries in my new RCP project, my RCP application can never
find them.
I'm very familiar with Eclipse, but this is my first RCP app. I only found
the answer buried in one of the 20 posts I read, so I thought I'd share
the solution in a more easily visible posting;
Situation: you create an RCP application, let's call it (X). You want to
do one of the following:
a) include some external jar (A) as a compile and runtime dependency for
(X).
b) include your eclipse project (B) as a compile and runtime dependency
for (X)
c) include your RCP plugin (C) as a compile and runtime dependency for (X).
Problem: compilation happens fine (because you set up your classpath
correctly under the project's 'properties' tab -> 'java build path').
However as soon as you run the damn thing, you get a NoClassDefFoundError.
Solution:
for situation (A):
1. drop jar (A) somewhere into the RCP project directory
2. navigate to your RCP project's source directory, and then into
META-INF\MANIFEST.mf.
3. Double click the manifest, click to the "Runtime" tab, and there should
be a "Classpath" section in this tab; click the "Add" button and find jar
(A) and add it.
Done! I don't like that you have to copy your external jars into this RCP
application directory, but there's no other way to do this.
for situation (B):
the answer is that this is impossible. RCP doesn't believe in allowing you
to include a normal java project as a dependency for an RCP project. It is
clearly a feature that is important, but it's not there. You can fall back
to method (A) by exporting the project's .class files into a jar (right
click the project and then select "export" on the menu that pops up).
for situation (C):
i've never done this, but from reading the tons of posts that i did to get
to this point, they say you need to open the manifest like situation (A),
but go to the "Dependencies" tab and make sure to add the plug-in to the
"Required Plug-ins" list.
I hope this saves you all frustration, since I saw five or ten posts that
all asked this same question but never got a response. Good luck RCPing
and wish me luck too!
-stan
|
|
|
Re: Solution to java.lang.NoClassDefFoundError with RCP [message #461499 is a reply to message #461388] |
Wed, 10 January 2007 14:40   |
Eclipse User |
|
|
|
Hi
you're essentially right. This problem comes up quite often, recently it
was put in bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=169396
(probably not only there)
But when it comes to defining the problem, lot of people are satisfied
with current status. If you have any idea, how to make this thing better
in eclipse, feel free to add a comment to the bugzilla.
Jacek
Stan napisał(a):
> Hi all,
>
> I struggled through what seemed to be a very basic issue; when I include
> external libraries in my new RCP project, my RCP application can never
> find them.
>
> I'm very familiar with Eclipse, but this is my first RCP app. I only
> found the answer buried in one of the 20 posts I read, so I thought I'd
> share the solution in a more easily visible posting;
>
> Situation: you create an RCP application, let's call it (X). You want to
> do one of the following:
> a) include some external jar (A) as a compile and runtime dependency for
> (X).
> b) include your eclipse project (B) as a compile and runtime dependency
> for (X)
> c) include your RCP plugin (C) as a compile and runtime dependency for (X).
>
> Problem: compilation happens fine (because you set up your classpath
> correctly under the project's 'properties' tab -> 'java build path').
> However as soon as you run the damn thing, you get a NoClassDefFoundError.
>
> Solution:
> for situation (A):
> 1. drop jar (A) somewhere into the RCP project directory
> 2. navigate to your RCP project's source directory, and then into
> META-INF\MANIFEST.mf.
> 3. Double click the manifest, click to the "Runtime" tab, and there
> should be a "Classpath" section in this tab; click the "Add" button and
> find jar (A) and add it.
> Done! I don't like that you have to copy your external jars into this
> RCP application directory, but there's no other way to do this.
>
> for situation (B):
> the answer is that this is impossible. RCP doesn't believe in allowing
> you to include a normal java project as a dependency for an RCP project.
> It is clearly a feature that is important, but it's not there. You can
> fall back to method (A) by exporting the project's .class files into a
> jar (right click the project and then select "export" on the menu that
> pops up).
>
> for situation (C):
> i've never done this, but from reading the tons of posts that i did to
> get to this point, they say you need to open the manifest like situation
> (A), but go to the "Dependencies" tab and make sure to add the plug-in
> to the "Required Plug-ins" list.
>
>
> I hope this saves you all frustration, since I saw five or ten posts
> that all asked this same question but never got a response. Good luck
> RCPing and wish me luck too!
>
> -stan
>
|
|
|
Re: Solution to java.lang.NoClassDefFoundError with RCP [message #461557 is a reply to message #461499] |
Fri, 12 January 2007 00:53  |
Eclipse User |
|
|
|
Originally posted by: chezanand.gmail.com
Hi
I have this dwe.jar which uses the BASE64EncoderStream.class found in
mail.jar. I've included mail.jar in the runtime classpath in plugin.xml of
my project much before dwe.jar but strangely still see the
NoClassDefFoundError. I guess this is something to do with the way eclipse
works/has to be configured.
Any clues? Is it related to the one below?
regards,
Chez
java.lang.NoClassDefFoundError: com/sun/mail/util/BASE64EncoderStream
at
com.dralasoft.util.Base64Serializer.deserialize(Base64Serial izer.java:49)
at
com.dralasoft.util.PasswordUtility.decodePassword(PasswordUt ility.java:67)
at com.dralasoft.workflow.u.getDataSource(u.java:156)
at com.dralasoft.workflow.DataSourceManager.b(DataSourceManager .java:142)
at
com.dralasoft.workflow.DataSourceManager.prepareDataSource(D ataSourceManager
..java:110)
at com.dralasoft.workflow.Engine.d(Engine.java:331)
at com.dralasoft.workflow.Engine.<clinit>(Engine.java:559)
at com.dralasoft.workflow.interfaces.local.a.getCoreEngine(a.ja va:83)
at
com.dralasoft.workflow.interfaces.local.LocalEngine.getId(Lo calEngine.java:2
9)
at com.dralasoft.gui.studio.Studio.<clinit>(Studio.java:95)
at
com.cisco.nm.cmp.client.ui.sample.views.WorkFlowEditorView.c reatePartControl
(WorkFlowEditorView.java:106)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:33
2)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:197)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReferenc
e.java:566)
at org.eclipse.ui.internal.Perspective.showView(Perspective.jav a:1675)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(Workbench Page.java:987)
at org.eclipse.ui.internal.WorkbenchPage.access$13(WorkbenchPag e.java:968)
at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.j ava:3514)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage .java:3511)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage .java:3487)
at
org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHan dler.java:148)
at
org.eclipse.ui.handlers.ShowViewHandler.openOther(ShowViewHa ndler.java:104)
at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHand ler.java:70)
at org.eclipse.ui.internal.ShowViewMenu$3.run(ShowViewMenu.java :114)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(Action
ContributionItem.java:539)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionI
tem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContribu
tionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
com.cisco.nm.cmp.client.ui.workbench.rcp.CMPApplication.run( CMPApplication.j
ava:49)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.
java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(
EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAp
pLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
"Jacek Pospychala" <jacekp@siat.pl> wrote in message
news:eo3ff6$gfo$1@utils.eclipse.org...
> Hi
> you're essentially right. This problem comes up quite often, recently it
> was put in bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=169396
> (probably not only there)
> But when it comes to defining the problem, lot of people are satisfied
> with current status. If you have any idea, how to make this thing better
> in eclipse, feel free to add a comment to the bugzilla.
>
> Jacek
>
> Stan napisal(a):
> > Hi all,
> >
> > I struggled through what seemed to be a very basic issue; when I include
> > external libraries in my new RCP project, my RCP application can never
> > find them.
> >
> > I'm very familiar with Eclipse, but this is my first RCP app. I only
> > found the answer buried in one of the 20 posts I read, so I thought I'd
> > share the solution in a more easily visible posting;
> >
> > Situation: you create an RCP application, let's call it (X). You want to
> > do one of the following:
> > a) include some external jar (A) as a compile and runtime dependency for
> > (X).
> > b) include your eclipse project (B) as a compile and runtime dependency
> > for (X)
> > c) include your RCP plugin (C) as a compile and runtime dependency for
(X).
> >
> > Problem: compilation happens fine (because you set up your classpath
> > correctly under the project's 'properties' tab -> 'java build path').
> > However as soon as you run the damn thing, you get a
NoClassDefFoundError.
> >
> > Solution:
> > for situation (A):
> > 1. drop jar (A) somewhere into the RCP project directory
> > 2. navigate to your RCP project's source directory, and then into
> > META-INF\MANIFEST.mf.
> > 3. Double click the manifest, click to the "Runtime" tab, and there
> > should be a "Classpath" section in this tab; click the "Add" button and
> > find jar (A) and add it.
> > Done! I don't like that you have to copy your external jars into this
> > RCP application directory, but there's no other way to do this.
> >
> > for situation (B):
> > the answer is that this is impossible. RCP doesn't believe in allowing
> > you to include a normal java project as a dependency for an RCP project.
> > It is clearly a feature that is important, but it's not there. You can
> > fall back to method (A) by exporting the project's .class files into a
> > jar (right click the project and then select "export" on the menu that
> > pops up).
> >
> > for situation (C):
> > i've never done this, but from reading the tons of posts that i did to
> > get to this point, they say you need to open the manifest like situation
> > (A), but go to the "Dependencies" tab and make sure to add the plug-in
> > to the "Required Plug-ins" list.
> >
> >
> > I hope this saves you all frustration, since I saw five or ten posts
> > that all asked this same question but never got a response. Good luck
> > RCPing and wish me luck too!
> >
> > -stan
> >
|
|
|
Goto Forum:
Current Time: Mon Apr 14 18:55:00 EDT 2025
Powered by FUDForum. Page generated in 0.09955 seconds
|