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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With