Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [jdt-core-dev] absolute path of an IClasspathEntry

I found the solution to my problem. Here it is :


IPath getAbsolutePath(IClasspathEntry currentEntry) {
    if (currentEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
    {
        IPath path = currentEntry.getPath();
        Object target =
            JavaModel.getTarget(
                ResourcesPlugin.getWorkspace().getRoot(),
                path,
                true);
        if (target instanceof IFile)
        {
            IFile file = (IFile) target;
            IPath absolutePath = file.getLocation();
        }
    }
    return absolutePath;
}


Julien

-----Original Message-----
From: jdt-core-dev-admin@xxxxxxxxxxx
[mailto:jdt-core-dev-admin@xxxxxxxxxxx] On Behalf Of Julien Ruaux
Sent: Tuesday, March 18, 2003 4:12 PM
To: jdt-core-dev@xxxxxxxxxxx
Subject: [jdt-core-dev] absolute path of an IClasspathEntry


Hi,

I have a project which is referencing a jar from another project. The
IClasspathEntry corresponding to this jar has a path which looks like
this : referencedProject/.../myjar.jar
I want to have an absolute handle on this jar (for copying purposes).
IPath.makeAbsolute() only puts a / in front of the path.
What is the way to obtain a really absolute path ? 

Thanks,

Julien



Back to the top