Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Need to get plug-in path


Hi,

As long as you don't package your plugin itself as a jar file (i.e. you leave it as a directory) then the following is the better way:

URL u = Platform.find(yourbundle, IPath to your file under your bundle);
if (u != null) {
  u = Platform.resolveURL(u);
  IPath p = new Path(new File(u.getFile()).getAbsolutePath());
  ...
}

The way you were using it requires knowing some internals, the above doesn't.

By the way, you can do this for now, but we intend to provide helpers for this because we need to do the same sort of thing too.

One more thing, was there some reason you couldn't use the standard RegisteredClassPathContainerInitializer that we provide for developers? This would take care of the classpath for you. The only reason you need to provide your own classpath container initializer is if you need to provide different set of jars depending on the configuration. If it is always the same set of jars, then the RegisteredClassPathContainerInitializer would be better for you to use.

Rich


"Janak Mulani" <janak.mulani@xxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

10/03/2005 12:35 PM

Please respond to
Discussions people developing code for the Visual Editor project

To
"Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc
Subject
RE: [ve-dev] Need to get plug-in path





Hi,

Sorry for being bit hasty in posting!

I found a soultion.

I can use IPath.makeAbsolute() before passing to newLibraryEntry().

Please confirm if this is ok or there is another way.

Thanks and regards,

Janak

> -----Original Message-----
> From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx]On
> Behalf Of Janak Mulani
> Sent: Monday, October 03, 2005 6:00 PM
> To: ve-Dev@Eclipse. Org
> Subject: [ve-dev] Need to get plug-in path
>
>
> Hi,
>
> I need to include a jar file from our plugin in the classpath Container.
>
> For this I need to know the absolute path of our plugin on the user's
> machine. How can I do it?
>
>
> In Eclipse 3.0.x the following worked:
>
> Bundle bundle = Platform.getBundle("plugin name");
> bundlePaths = bundle.getLocation().split("@");
> path = new Path(bundlePaths[1] + "my.jar");
> JavaCore.newLibraryEntry(path,null,null)
>
> In Eclipse 3.1:
> The above does not work because getLocation90 returns relative
> path and not
> absolute path. The reason is that
> ConfigurationActivator.getBudlesToInstall() is now storing relative paths
> instead of absolute path.
>
> newLibraryEntry(path, null, null) expects abs path, so its
> assertion fails.
>

_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top