Reputation: 91
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
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