| 
| Fully resolved classpath [message #648] | Sat, 19 April 2003 05:39  |  | 
| Eclipse User  |  |  |  |  | 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 11:07  |  | 
| Eclipse User  |  |  |  |  | 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
 >
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.03676 seconds