Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Fully resolved classpath
Fully resolved classpath [message #648] Sat, 19 April 2003 09:39 Go to next message
Eclipse UserFriend
Originally posted by: vlad_ender.hotmail.com

Hi,
I'm writing a plugin for my code analyser. It needs a full run/buildtime
classpath so that it can build the full symbol table.
Unfortunately, I can't figure out how to do it in eclipse. Some libraries
are ok (and I get the full absolute path), but for some I get just (say)
"/lib/somelib.jar". This example is when I tried it on another plugin,
which had lib/somelib.jar in its plugin directory. The IPath element
claims the path is absolute, which, with the leading "/" looks pretty
weird. I would not mind getting relative path, as long as I could have a
way of pointing my classloader in the right direction.
I don't even mention dependent projects, as that looks even worse - I
don't want to analyse the source for them (or not necessarily), I just
want the output directory and all libraries.
I'm sure there must be a way of doing it, as generating ant build file
seems to manage it ok. I wasn't able to find out what piece of code is
generating it though.
Thanks for any help,
Vlad
Re: Fully resolved classpath [message #1158 is a reply to message #648] Mon, 21 April 2003 15:07 Go to previous message
Martin Aeschlimann is currently offline Martin AeschlimannFriend
Messages: 71
Registered: July 2009
Member
There are internal JARs and external JARs. Internal JARs are described
by a 'workspace' path. You have to get the JAR's resource and use
'getLocation' to get the resource's external location.

IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IResource jarFile= root.findMember(jarPath);
if (jarFile != null) {
return jarFile.getLocation();
} else {
// no workspace resource existing with the path described by jarPath
// -> must be an external JAR (or an invalid classpath)
}

Similar procedure to get the output location of dependend projects
IProject project= root.findMember(dependendProjectPath);
IJavaProject jProject= JavaCore.create(project);
IPath outputLocation= jProject.getOutputLocation()

Martin


Vlad Ender wrote:
> Hi,
> I'm writing a plugin for my code analyser. It needs a full run/buildtime
> classpath so that it can build the full symbol table.
> Unfortunately, I can't figure out how to do it in eclipse. Some libraries
> are ok (and I get the full absolute path), but for some I get just (say)
> "/lib/somelib.jar". This example is when I tried it on another plugin,
> which had lib/somelib.jar in its plugin directory. The IPath element
> claims the path is absolute, which, with the leading "/" looks pretty
> weird. I would not mind getting relative path, as long as I could have a
> way of pointing my classloader in the right direction.
> I don't even mention dependent projects, as that looks even worse - I
> don't want to analyse the source for them (or not necessarily), I just
> want the output directory and all libraries.
> I'm sure there must be a way of doing it, as generating ant build file
> seems to manage it ok. I wasn't able to find out what piece of code is
> generating it though.
> Thanks for any help,
> Vlad
>
Previous Topic:simple type name -> fully-qualified type name?
Next Topic:Configuring arguments for Launch Configuration
Goto Forum:
  


Current Time: Sat Oct 19 10:52:57 GMT 2024

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

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

Back to the top