Home » Eclipse Projects » Plugin Development Environment (PDE) » platform:/plugin URLs behave differently for deployed plugins and plugins started from source
platform:/plugin URLs behave differently for deployed plugins and plugins started from source [message #68885] |
Thu, 23 July 2009 10:30 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Steffen Zschaler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steffen.zschaler%40kcl.ac.uk) Messages: 266 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------030207050804000606000800
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I'm working on a plugin that, among other stuff, contains a number of
non-Java files that need to be accessed from other plugins later on.
These files reside in paths like /src/a/b/c/foo.bar in my plugin project
(lets call it myplugin). To access these files from some other plugin, I
have been successfully using the following line of code so far:
URL urlToFoo = FileLocator.toFileURL(new URL(
"platform:/plugin/myplugin/src/a/b/c/foo.bar"));
This works very well while I am testing the plugin; that is, I have the
plugin project open in an Eclipse instance and start another Eclipse
instance from there in which I am testing my code. When I properly
deployed the plugin for the first time (i.e., I exported the plugin
projects as JAR files and dropped them into the dropins/ folder of
another Eclipse instance), the code stopped working because it could not
find the file anymore. After some debugging, I understood that this is
because I am not exporting sources with my plugin, so the src/ folder
doesn't actually exist, even though foo.bar exists in the plugin
(specifically in /a/b/c/foo.bar). So, I changed my code to the following:
URL urlToFoo = FileLocator.toFileURL(new URL(
"platform:/plugin/myplugin/a/b/c/foo.bar"));
(that is, I left out the /src/ bit). This seems to work OK with the JAR
version of the plugin, but it does not work when I use the plugin in my
test environment as above.
I don't want to export sources with my plugin jar. Also, the files
really have to be in the src folder, because they are going to be used
by openArchitectureWare, which needs them to be available on the
classpath in a variety of circumstances.
Is there any way to correctly use platform: protocol URLs to access this
file? Alternatively, do I need to make any changes to the build
specifications of my plugin?
Many thanks in advance,
Steffen
--------------030207050804000606000800
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I'm working on a plugin that, among other stuff, contains a number of
non-Java files that need to be accessed from other plugins later on.
These files reside in paths like <tt>/src/a/b/c/foo.bar</tt> in my
plugin project (lets call it <tt>myplugin</tt>). To access these files
from some other plugin, I have been successfully using the following
line of code so far:<br>
<blockquote>
<pre>URL urlToFoo = FileLocator.toFileURL(new URL(
"platform:/plugin/myplugin/src/a/b/c/foo.bar"));
</pre>
</blockquote>
This works very well while I am testing the plugin; that is, I have the
plugin project open in an Eclipse instance and start another Eclipse
instance from there in which I am testing my code. When I properly
deployed the plugin for the first time (i.e., I exported the plugin
projects as JAR files and dropped them into the dropins/ folder of
another Eclipse instance), the code stopped working because it could
not find the file anymore. After some debugging, I understood that this
is because I am not exporting sources with my plugin, so the src/
folder doesn't actually exist, even though foo.bar exists in the plugin
(specifically in <tt>/a/b/c/foo.bar</tt>). So, I changed my code to
the following:<br>
<blockquote>
<pre>URL urlToFoo = FileLocator.toFileURL(new URL(
"platform:/plugin/myplugin/a/b/c/foo.bar"));
</pre>
</blockquote>
(that is, I left out the <tt>/src/</tt> bit). This seems to work OK
with the JAR version of the plugin, but it does not work when I use the
plugin in my test environment as above.<br>
<br>
I don't want to export sources with my plugin jar. Also, the files
really have to be in the src folder, because they are going to be used
by openArchitectureWare, which needs them to be available on the
classpath in a variety of circumstances.<br>
<br>
Is there any way to correctly use platform: protocol URLs to access
this file? Alternatively, do I need to make any changes to the build
specifications of my plugin?<br>
<br>
Many thanks in advance,<br>
<br>
Steffen<br>
</body>
</html>
--------------030207050804000606000800--
|
|
|
Re: platform:/plugin URLs behave differently for deployed plugins and plugins started from source [message #412183 is a reply to message #68885] |
Thu, 30 July 2009 08:57 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Steffen Zschaler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steffen.zschaler%40kcl.ac.uk) Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi again,
I found that Class.getResource() works reliably in both scenarios when
the file of interest is located on the classpath.
Thanks,
Steffen
Steffen Zschaler wrote:
> Hi,
>
> I'm working on a plugin that, among other stuff, contains a number of
> non-Java files that need to be accessed from other plugins later on.
> These files reside in paths like /src/a/b/c/foo.bar in my plugin
> project (lets call it myplugin). To access these files from some other
> plugin, I have been successfully using the following line of code so far:
>
> URL urlToFoo = FileLocator.toFileURL(new URL(
> "platform:/plugin/myplugin/src/a/b/c/foo.bar"));
>
>
> This works very well while I am testing the plugin; that is, I have
> the plugin project open in an Eclipse instance and start another
> Eclipse instance from there in which I am testing my code. When I
> properly deployed the plugin for the first time (i.e., I exported the
> plugin projects as JAR files and dropped them into the dropins/ folder
> of another Eclipse instance), the code stopped working because it
> could not find the file anymore. After some debugging, I understood
> that this is because I am not exporting sources with my plugin, so the
> src/ folder doesn't actually exist, even though foo.bar exists in the
> plugin (specifically in /a/b/c/foo.bar). So, I changed my code to the
> following:
>
> URL urlToFoo = FileLocator.toFileURL(new URL(
> "platform:/plugin/myplugin/a/b/c/foo.bar"));
>
>
> (that is, I left out the /src/ bit). This seems to work OK with the
> JAR version of the plugin, but it does not work when I use the plugin
> in my test environment as above.
>
> I don't want to export sources with my plugin jar. Also, the files
> really have to be in the src folder, because they are going to be used
> by openArchitectureWare, which needs them to be available on the
> classpath in a variety of circumstances.
>
> Is there any way to correctly use platform: protocol URLs to access
> this file? Alternatively, do I need to make any changes to the build
> specifications of my plugin?
>
> Many thanks in advance,
>
> Steffen
|
|
|
Re: platform:/plugin URLs behave differently for deployed plugins and plugins started from source [message #600130 is a reply to message #68885] |
Thu, 30 July 2009 08:57 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Steffen Zschaler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=steffen.zschaler%40kcl.ac.uk) Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi again,
I found that Class.getResource() works reliably in both scenarios when
the file of interest is located on the classpath.
Thanks,
Steffen
Steffen Zschaler wrote:
> Hi,
>
> I'm working on a plugin that, among other stuff, contains a number of
> non-Java files that need to be accessed from other plugins later on.
> These files reside in paths like /src/a/b/c/foo.bar in my plugin
> project (lets call it myplugin). To access these files from some other
> plugin, I have been successfully using the following line of code so far:
>
> URL urlToFoo = FileLocator.toFileURL(new URL(
> "platform:/plugin/myplugin/src/a/b/c/foo.bar"));
>
>
> This works very well while I am testing the plugin; that is, I have
> the plugin project open in an Eclipse instance and start another
> Eclipse instance from there in which I am testing my code. When I
> properly deployed the plugin for the first time (i.e., I exported the
> plugin projects as JAR files and dropped them into the dropins/ folder
> of another Eclipse instance), the code stopped working because it
> could not find the file anymore. After some debugging, I understood
> that this is because I am not exporting sources with my plugin, so the
> src/ folder doesn't actually exist, even though foo.bar exists in the
> plugin (specifically in /a/b/c/foo.bar). So, I changed my code to the
> following:
>
> URL urlToFoo = FileLocator.toFileURL(new URL(
> "platform:/plugin/myplugin/a/b/c/foo.bar"));
>
>
> (that is, I left out the /src/ bit). This seems to work OK with the
> JAR version of the plugin, but it does not work when I use the plugin
> in my test environment as above.
>
> I don't want to export sources with my plugin jar. Also, the files
> really have to be in the src folder, because they are going to be used
> by openArchitectureWare, which needs them to be available on the
> classpath in a variety of circumstances.
>
> Is there any way to correctly use platform: protocol URLs to access
> this file? Alternatively, do I need to make any changes to the build
> specifications of my plugin?
>
> Many thanks in advance,
>
> Steffen
|
|
|
Goto Forum:
Current Time: Sun Sep 01 01:14:39 GMT 2024
Powered by FUDForum. Page generated in 0.03642 seconds
|