Importing libraries in eclipse programmatically

Posted by Krt_Malta on Stack Overflow See other posts from Stack Overflow or by Krt_Malta
Published on 2010-03-27T23:10:00Z Indexed on 2010/03/27 23:13 UTC
Read the original article Hit count: 182

Filed under:
|

Hi,

Is there a way I could put a library (Jar file) into an Eclipse project programatically? Up to now I've managed to do an external reference to it programatically using

IPath path = new Path("C:\\Hello\\jtwitter.jar");
            libraries.add(JavaCore.newLibraryEntry(path, null, null));
            //add libs to project class path
            try {
                javaProject.setRawClasspath(libraries.toArray(new IClasspathEntry[libraries.size()]), null);
            } catch (JavaModelException e1) {
                e1.printStackTrace();
            }
            }

however I'd like to copy the jtwitter file to the project folder programatically so I could reference it as jtwitter.jar only. Can this be done please?

Thanks a lot and regards, Krt_Malta

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about libraries