Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » External Jars of an IProject
External Jars of an IProject [message #332568] Wed, 29 October 2008 08:37 Go to next message
Andreas is currently offline AndreasFriend
Messages: 5
Registered: July 2009
Junior Member
Hi,

i'm trying to convert a ILaunchConfiguration to a command string, that can
be executed on a command line.

My current problem are external Jar files a project can reference. I can't
figure out, how to get this information out of
ILaunchConfiguration/IProject objects.

Reference projects for example can be found like

IProject project = config.getFile().getProject();
project.getReferencedProjects()

But there is no project.getExternalLibraries().

cheers Andreas
Re: External Jars of an IProject [message #332569 is a reply to message #332568] Wed, 29 October 2008 09:20 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
Andreas wrote:
> i'm trying to convert a ILaunchConfiguration to a command string, that
> can be executed on a command line.

Is there any particular reason why you need this? This string is visible
from the Eclipse user interface, by the way.

http://wiki.eclipse.org/Graphical_Eclipse_FAQs#How_do_I_chec k_for_the_command_line_invocation_that_Eclipse_used_to_launc h_an_application.3F

> But there is no project.getExternalLibraries().

This is because a project is just, well, a generic project. It has no
Java classpath concepts tied in to it because the resources API is meant
to simply deal with resources and Java classpath is something entirely
different and is provided by JDT's APIs.

You should do something like JavaCore.create(project).getRawClasspath().

http://help.eclipse.org/stable/nftopic/org.eclipse.jdt.doc.i sv/reference/api/index.html

Regards,
Rem
Re: External Jars of an IProject [message #332686 is a reply to message #332569] Wed, 05 November 2008 09:40 Go to previous message
Andreas is currently offline AndreasFriend
Messages: 5
Registered: July 2009
Junior Member
Thanks Rem,

i didn't know about Eclipses "generic project" - "Java project" handling.
I just assumed everything would be done via key-value pairs in
ILaunchConfiguration.getAttributes.
Where can i find more information than the JavaDoc stuff?

IJavaProject javaproject = JavaCore.create(project);
IClasspathEntry[] cp = javaproject.getRawClasspath();
for (IClasspathEntry cpe : cp) {
if (cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
classpath.add(cpe.getPath().toOSString());
}
}
Previous Topic:How to implement a MessageDialog
Next Topic:Help on Toolbar positioning
Goto Forum:
  


Current Time: Sat May 04 04:42:19 GMT 2024

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

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

Back to the top