ClassLoader Q re: Custom AntRunner-ish Runner [message #279725] |
Sat, 22 January 2005 13:12  |
Eclipse User |
|
|
|
Originally posted by: iwan.global.co.za
Hi,
I'm trying to write something analogous, but different to AntRunner and
need to understand the ClassLoader issues involved. Any help would be
greatly appreciated. (actual questions are right at the bottom if you
want to skip the long bits...)
-------------------- Context --------------------
Assume I have an IPlatformRunnable implementation (say, A) that is part of
a plugin.
I need to run A from the commandline while the plugin it is a part
(pluginA) of is under development (and thus not installed). And, of
course, I need A to see classes in the bin directory of the plugin that is
under development.
The general plan is to write a separate plugin containing an
implementation of IPlatformRunnable (call it Runner) and declare it as an
extension of the extention point org.eclipse.core.runtime.applications. I
can then (a) install this seperate plugin and (b) then run
org.eclipse.launcher.Main from the commandline and pass it a -application
argument specifying my Runner in plugin j in order to run Runner. This is
how AntRunner is run for tests from the commandline.
Upon such an invocation Runner then loads and runs A: The class name of A
can also be passed in the invocation to org.eclipse.launcher.Main.
-------------------- my issue --------------------
The real problem is that A has the following needs regarding class loading:
a) it needs to behave as though it is part of pluginA: it should be able
to see classes in plugins that pluginA depends on
b) it should load these classes from the same ClassLoader as pluginA loads
its classes
c) if a -dev parameter was also passed to Main (say, with the bin
directory of pluginA under development as addition to the classpath), it
should also be able to load classes from that additional classpath entry
(possibly entries).
I have tried writing a ClassLoader that takes a pluginid and delegates
loadClass(String) to the Platform.getBundle(bundleId).loadClass(String).
Trying to load a class using this ClassLoader finds classes pluginA
depends on, but not the classes of pluginA which are lying in its bin
directory
--------------- My questions are:
1) Is there a ClassLoader for the non-installed plugInA which knows about
the extra classpath entries passed via the -dev argument to launcher.Main?
2) Alternatively (but I suspect problems with this approach because of my
requirement (b) above), how can I get to the parameters passed as -dev in
my Runner so I can construct a ClassLoader that is smart enough to search
in those places too?
Thanks
-Iwan Vosloo
|
|
|
Re: ClassLoader Q re: Custom AntRunner-ish Runner [message #279785 is a reply to message #279725] |
Mon, 24 January 2005 11:47  |
Eclipse User |
|
|
|
Originally posted by: Chris_Laffra.ca.ibm.com
Long question indeed. I am not sure if i completely understand it.
This page describes classpath issues for plugins:
http://www.eclipsefaq.org/chris/faq/html/faq104.html
Perhaps that page answers some of your questions?
--
Chris Laffra, http://eclipsefaq.org
"Iwan Vosloo" <iwan@global.co.za> wrote in message
news:csu52e$i7a$1@www.eclipse.org...
> Hi,
>
> I'm trying to write something analogous, but different to AntRunner and
> need to understand the ClassLoader issues involved. Any help would be
> greatly appreciated. (actual questions are right at the bottom if you
> want to skip the long bits...)
>
> -------------------- Context --------------------
> Assume I have an IPlatformRunnable implementation (say, A) that is part of
> a plugin.
>
> I need to run A from the commandline while the plugin it is a part
> (pluginA) of is under development (and thus not installed). And, of
> course, I need A to see classes in the bin directory of the plugin that is
> under development.
>
> The general plan is to write a separate plugin containing an
> implementation of IPlatformRunnable (call it Runner) and declare it as an
> extension of the extention point org.eclipse.core.runtime.applications. I
> can then (a) install this seperate plugin and (b) then run
> org.eclipse.launcher.Main from the commandline and pass it a -application
> argument specifying my Runner in plugin j in order to run Runner. This is
> how AntRunner is run for tests from the commandline.
>
> Upon such an invocation Runner then loads and runs A: The class name of A
> can also be passed in the invocation to org.eclipse.launcher.Main.
>
> -------------------- my issue --------------------
> The real problem is that A has the following needs regarding class
loading:
> a) it needs to behave as though it is part of pluginA: it should be able
> to see classes in plugins that pluginA depends on
> b) it should load these classes from the same ClassLoader as pluginA loads
> its classes
> c) if a -dev parameter was also passed to Main (say, with the bin
> directory of pluginA under development as addition to the classpath), it
> should also be able to load classes from that additional classpath entry
> (possibly entries).
>
>
> I have tried writing a ClassLoader that takes a pluginid and delegates
> loadClass(String) to the Platform.getBundle(bundleId).loadClass(String).
> Trying to load a class using this ClassLoader finds classes pluginA
> depends on, but not the classes of pluginA which are lying in its bin
> directory
>
> --------------- My questions are:
>
> 1) Is there a ClassLoader for the non-installed plugInA which knows about
> the extra classpath entries passed via the -dev argument to launcher.Main?
>
> 2) Alternatively (but I suspect problems with this approach because of my
> requirement (b) above), how can I get to the parameters passed as -dev in
> my Runner so I can construct a ClassLoader that is smart enough to search
> in those places too?
>
>
> Thanks
> -Iwan Vosloo
>
|
|
|
Powered by
FUDForum. Page generated in 0.03632 seconds