[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: [JDT] IClassPathEntry to File System Absolute Path Question
|
You can also get a File from it with:
File f = entry.getPath().toFile()
Are you by any chance doing this to load classes from the workspace? I have
the same issue. What's your solution?
"Scott Anderson" <easie@xxxxxxxxxxxx> wrote in message
news:alq0pj$gdm$1@xxxxxxxxxxxxxxxx
> Jerome,
>
> That looks like exactly what I wanted. Thanks again for the prompt
> response.
>
> --Scott
>
>
> "Jerome Lanneluc" <jerome_lanneluc@xxxxxxx> wrote in message
> news:3D80545A.23677A12@xxxxxxxxxx
> > Scott,
> >
> > The following should do what you expect:
> >
> > IFile jarFile =
> >
>
ResourcesPlugin.getWorkspace().getRoot().getFile(classpathEntry.getPath());
> > return jarFile.getLocation().toOSString();
> >
> > HTH,
> > Jerome
> >
> > Scott Anderson wrote:
> > >
> > > From a plugin I'm trying to retrieve all of a project's classpath
> entries
> > > and convert them to an absolute file system paths. The problem I'm
> running
> > > into is with classpath entries that were added using Properties->Java
> Build
> > > Path->Add Jars... which adds a jar that is already contained within a
> > > workspace project to the path. These particular entries are recorded
> with a
> > > path that looks like /ProjectName/jarname.jar and I can't figure out
how
> to
> > > create the full file system path of the form
> > > <device>/<PathToWorkspace>/ProjectName/jarname.jar.
> > >
> > > The two pieces of code I've tried have been the following:
> > > classpathEntry.getPath().makeAbsolute().toOSString();
> > > and
> > >
>
JavaCore.getResolvedClasspathEntry(classpathEntry).getPath().makeAbsolute().
> > > toOSString();
> > >
> > > Yet neither will add the device and workspace path prefixes to the
path.
> Is
> > > there a simple technique I'm missing?
> > >
> > > Thanks in advance,
> > > Scott
>
>