Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Create Java project programmatically
Create Java project programmatically [message #820997] Wed, 14 March 2012 20:39 Go to next message
Horia Darabant is currently offline Horia DarabantFriend
Messages: 2
Registered: March 2012
Junior Member
Hello everybody !

I'm searching since a few weeks a way to create programmatically a Java project and/or at least to add an existing one from the workspace.

I have found this code while searching

IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
System.out.println(ResourcesPlugin.getWorkspace().getRoot().getName());
System.out.println("hello");
IProject project = root.getProject("../testTest");
project.create(null);
project.open(null);
				
IProjectDescription dscription = project.getDescription();
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
project.setDescription(description, null);
				
IJavaProject javaProject = JavaCore.create(project);


But when i get rid of all the errors by including the necessary jars, I get an exception at the execution on the first line Sad.

Can anyone help me?
Re: Create Java project programmatically [message #821389 is a reply to message #820997] Thu, 15 March 2012 09:42 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
What is the exception you are getting? Note that your application should be an eclipse plugin..
Re: Create Java project programmatically [message #823796 is a reply to message #820997] Sun, 18 March 2012 22:34 Go to previous message
Horia Darabant is currently offline Horia DarabantFriend
Messages: 2
Registered: March 2012
Junior Member
Sorry for being long to respond. I guess the problem comes from the fact I didn't specified it as a plugin. I'll retry it when I can.

Thank you for your answer
Previous Topic:Why System.console() returns Null?
Next Topic:Can I use gnumake (similar to ANT) scripts to compile soucres?
Goto Forum:
  


Current Time: Tue Apr 16 05:29:51 GMT 2024

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

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

Back to the top