francesco pasini
francesco pasini

Reputation: 91

Java Eclipse: Programmatically import plug-ins and fragments

I need to programmatically import a .jar in my workspace as I do when I use the menu:
Import -> Plug-in development -> Plug-ins and Fragments.

Here I find the code for import a java project:

IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription( new Path("PROJECT_PATH/.project"));

IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());

project.create(description, null);
project.open(null);

But I don't have .project on .jar file. Can you help me?

Thanks

Upvotes: 6

Views: 462

Answers (1)

Francis Upton IV
Francis Upton IV

Reputation: 19443

You are close, do all of that and then create an IFile object and read the Jar file into the IFile object. The documentation has some helpful snippets of code to show you how to do this.

Upvotes: 2

Related Questions