Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » headless new JavaProject from sources
headless new JavaProject from sources [message #482465] Wed, 26 August 2009 12:16 Go to next message
Eclipse UserFriend
I need to create programatically a java project from existing sources (in
a headless environment). Just like you would if you'd go to file - new
JavaProject - select "Create project form existing source" - enter the
folder name - click finish.

I've tried something like this :

NewJavaProjectWizardPageOne p = new NewJavaProjectWizardPageOne();
NewJavaProjectWizardPageTwo p2 = new NewJavaProjectWizardPageTwo(p);
p.setProjectLocationURI(new URI(string)); // path to project
p.setProjectName("myProject");
p2.performFinish(new NullProgressMonitor());

but I get a

java.lang.NoClassDefFoundError:
org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne
at rcp.Application.createProject(Application.java:46)
at rcp.Application.start(Application.java:33)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
...


even if I add the jface jar file to the classpath with the -cp option...

Thank you,
George
Re: headless new JavaProject from sources [message #482648 is a reply to message #482465] Thu, 27 August 2009 08:47 Go to previous messageGo to next message
Eclipse UserFriend
Ganea George wrote:
> I need to create programatically a java project from existing sources
> (in a headless environment). Just like you would if you'd go to file -
> new JavaProject - select "Create project form existing source" - enter
> the folder name - click finish.
>
> I've tried something like this :
>
> NewJavaProjectWizardPageOne p = new NewJavaProjectWizardPageOne();
Wizard is UI and hence it obviously won't work in headless mode.

Dani
> NewJavaProjectWizardPageTwo p2 = new NewJavaProjectWizardPageTwo(p);
> p.setProjectLocationURI(new URI(string)); // path to project
> p.setProjectName("myProject");
> p2.performFinish(new NullProgressMonitor());
>
> but I get a
> java.lang.NoClassDefFoundError:
> org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne
> at rcp.Application.createProject(Application.java:46)
> at rcp.Application.start(Application.java:33)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
>
> ..
>
>
> even if I add the jface jar file to the classpath with the -cp option...
>
> Thank you,
> George
>
Re: headless new JavaProject from sources [message #482774 is a reply to message #482648] Thu, 27 August 2009 17:57 Go to previous message
Eclipse UserFriend
>> NewJavaProjectWizardPageOne p = new NewJavaProjectWizardPageOne();
> Wizard is UI and hence it obviously won't work in headless mode.

> Dani


Yes, but (some of) the code that creates the java project from sources is
written in the classes NewJavaProjectWizard...
So I hacked my way to a solution. I basically copied these classes (and a
couple of other classes) in the application code and changed them so that
they don't have anything to do with the UI. Then, of course, I used those
instead of the "real" ones.

George
Previous Topic:Connection to JNDI datasource
Next Topic:Using/testing Java Preferences API within Eclipse
Goto Forum:
  


Current Time: Thu Nov 06 23:48:37 EST 2025

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

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

Back to the top