Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » java.lang.NoClassDefFoundError: org/eclipse/core/resources/ResourcesPlugin(Something missing in my plugin?)
java.lang.NoClassDefFoundError: org/eclipse/core/resources/ResourcesPlugin [message #1058087] Fri, 10 May 2013 21:44 Go to next message
Robert Smith is currently offline Robert SmithFriend
Messages: 3
Registered: May 2013
Junior Member
Hi all,

I hope you can help, I'm at the end of my rope. I am writing a very simple headless plugin (extending org.eclipse.core.runtime.applications). The sole purpose of this plugin is import existing sample projects into Eclipse from the command line.

I know that there is a plugin in cdt which already does this. However, this is part of an installer, so can not be allowed to fail and pop up any dialogs.

The relevant code in my IApplication's start() method is:

try
{
System.out.println("In try block");

description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(projectName + "/.project"));

IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
project.create(description, null);
project.open(null);
System.out.println("Done.");
}
catch (CoreException e)
{
}


Here is my manifest:


Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Intel Headless Utilities
Bundle-SymbolicName: com.intel.eclipse.headless;singleton:=true
Bundle-Version: 1.0.0.0
Bundle-Activator: com.intel.eclipse.headless.Activator
Bundle-Vendor: Intel
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy


Note that I have declared a dependency on "org.eclipse.core.resources". Here is the plugin.xml:


<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="import"
point="org.eclipse.core.runtime.applications">
<application
cardinality="singleton-global"
thread="main"
visible="true">
<run
class="com.xxx.eclipse.headless.Import">
</run>
</application>
</extension>
</plugin>


When I try to run this using "eclipse -consoleLog -data C:\Android\eclipse\workspace -noSplash -application com.xxx.eclipse.headless.import -project C:\Android\eclipse\workspace\helloworld", I get the following error:


!SESSION 2013-05-10 14:11:36.598 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -application com.xxx.eclipse.headless.import -import C:/Android/eclipse/workspace/helloworld
Command-line arguments: -data C:\Android\eclipse\workspace -application com.xxx.eclipse.headless.import -import C:/Android/eclipse/workspace/helloworld

!ENTRY org.eclipse.osgi 4 0 2013-05-10 14:11:38.508
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: org/eclipse/core/resources/ResourcesPlugin
at com.xxx.eclipse.headless.Import.importProject(Import.java:97)
at com.xxx.eclipse.headless.Import.start(Import.java:60)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
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.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.resources.ResourcesPlugin
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more


I don't understand what the problem could be. I have declared the dependency correctly. What am I missing?

Many thanks,

Robert
Re: java.lang.NoClassDefFoundError: org/eclipse/core/resources/ResourcesPlugin [message #1058124 is a reply to message #1058087] Sun, 12 May 2013 06:05 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2342
Registered: July 2009
Senior Member
It might just be the forum software messing with indentation, but when you open the manifest file in the PDE Manifest Editor, is the resources plug-in still listed among the dependencies?

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: java.lang.NoClassDefFoundError: org/eclipse/core/resources/ResourcesPlugin [message #1058915 is a reply to message #1058124] Wed, 15 May 2013 18:04 Go to previous messageGo to next message
Robert Smith is currently offline Robert SmithFriend
Messages: 3
Registered: May 2013
Junior Member
Yes, the plugin is listed in the manifest editor. Sorry for the bad formatting.
Re: java.lang.NoClassDefFoundError: org/eclipse/core/resources/ResourcesPlugin [message #1059764 is a reply to message #1058915] Tue, 21 May 2013 14:32 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2342
Registered: July 2009
Senior Member
Are there more exceptions and errors further down?

---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Eclipse
Next Topic:Create my own IDE for my own language like LDT (LUA)
Goto Forum:
  


Current Time: Mon Dec 22 18:33:07 GMT 2014

Powered by FUDForum. Page generated in 0.01967 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software