Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Dynamic classloading at runtime
Dynamic classloading at runtime [message #47881] Mon, 09 May 2005 11:09 Go to next message
Eclipse UserFriend
Originally posted by: info.bastian-bergerhoff.com

Hello,

I am fighting with what I thought would be a straightforward problem. I have
browsed the newsgroups for a while now but did not come up with an answer.
The problem is as follows:

I am trying to write a plug-in for a framework which generates GUIs for (a
configurable subset of the) classes written on-the-fly
(www.nakedobjects.org). What I want to get at is a Smalltalk-like experience
where you write code and have the code running and testable in a view at the
same time (no runtime-workspace or the like). What I need for that is to be
able to add (and replace) classes to the classpath of the plugin at runtime.
I wrote a builder which does copy everything necessary to a place of my
choice (which would I guess be somewhere on the plugin-installation path).
Now everything works fine within the PDE when I run my plug-in in a
runtime-workbench since that is actually looking at the plug-in-project's
output-directory (which is where my builder puts the classes generated from
the project within the runtime-workbench).

Unfortunately, the same thing does not work when I install the plugin and
try it from the standard Eclipse. I tried playing with both plugin.xml as
well as manifest.mf but to no avail.

An additional problem is obviously that I do not know any packages etc at
build-time of the plugin...

Any hints are highly appreciated.

Thanks, cheers, Bastian
Re: Dynamic classloading at runtime [message #47911 is a reply to message #47881] Tue, 10 May 2005 02:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pascal.ibm.canada

If I got you correctly, you wrote a plug-in that generates java code
compiles it and then you want to run it and all that dynamically.

Your plugin A generates code. This code must be generated like a plugin
in that it must have a Manifest.mf (or more simply in your case a
plugin.xml using the 3.0 markup) and classes. The classes can be in a
folder in the location you pick for your plugin.
Once the generation of your plugin is done, you simply needs to install
it and then resolve it, and it will be available.

Now if you change a class, you will have to uninstall then reinstall the
plugin since JVMs only support hot code replace in debug mode.
Note that when doing that you might want to use a secondary generation
location.

Example of how to structure your generated plugin:
<someFolder>/
META-INF/
MANIFEST.MF (bundle-Classpath: code/)
plugin.xml
code/
org.mycode.Bar.class
org.mycode.Zoo.class
...

HTH,

PaScaL

Ps: now that all the dynamic support is released in eclipse you might
want to ask your questions on rcp or platform newsgroup


Bastian Bergerhoff wrote:
> Hello,
>
> I am fighting with what I thought would be a straightforward problem. I have
> browsed the newsgroups for a while now but did not come up with an answer.
> The problem is as follows:
>
> I am trying to write a plug-in for a framework which generates GUIs for (a
> configurable subset of the) classes written on-the-fly
> (www.nakedobjects.org). What I want to get at is a Smalltalk-like experience
> where you write code and have the code running and testable in a view at the
> same time (no runtime-workspace or the like). What I need for that is to be
> able to add (and replace) classes to the classpath of the plugin at runtime.
> I wrote a builder which does copy everything necessary to a place of my
> choice (which would I guess be somewhere on the plugin-installation path).
> Now everything works fine within the PDE when I run my plug-in in a
> runtime-workbench since that is actually looking at the plug-in-project's
> output-directory (which is where my builder puts the classes generated from
> the project within the runtime-workbench).
>
> Unfortunately, the same thing does not work when I install the plugin and
> try it from the standard Eclipse. I tried playing with both plugin.xml as
> well as manifest.mf but to no avail.
>
> An additional problem is obviously that I do not know any packages etc at
> build-time of the plugin...
>
> Any hints are highly appreciated.
>
> Thanks, cheers, Bastian
>
>
>
Re: Dynamic classloading at runtime [message #47940 is a reply to message #47911] Tue, 10 May 2005 08:28 Go to previous message
Eclipse UserFriend
Originally posted by: info.bastian-bergerhoff.com

Hello Pascal,

thanks for your answer. Looks like I will go for a "RunAs"-configuration in
this case (not smalltalkish, but close enough, and I can profit from
Eclipse's HotCodeReplace-Infrastructure).

Cheers, Bastian


"Pascal Rapicault" <pascal@ibm.canada> schrieb im Newsbeitrag
news:d5p7ca$p5r$1@news.eclipse.org...
> If I got you correctly, you wrote a plug-in that generates java code
> compiles it and then you want to run it and all that dynamically.
>
> Your plugin A generates code. This code must be generated like a plugin
> in that it must have a Manifest.mf (or more simply in your case a
> plugin.xml using the 3.0 markup) and classes. The classes can be in a
> folder in the location you pick for your plugin.
> Once the generation of your plugin is done, you simply needs to install
> it and then resolve it, and it will be available.
>
> Now if you change a class, you will have to uninstall then reinstall the
> plugin since JVMs only support hot code replace in debug mode.
> Note that when doing that you might want to use a secondary generation
> location.
>
> Example of how to structure your generated plugin:
> <someFolder>/
> META-INF/
> MANIFEST.MF (bundle-Classpath: code/)
> plugin.xml
> code/
> org.mycode.Bar.class
> org.mycode.Zoo.class
> ...
>
> HTH,
>
> PaScaL
>
> Ps: now that all the dynamic support is released in eclipse you might
> want to ask your questions on rcp or platform newsgroup
>
>
> Bastian Bergerhoff wrote:
> > Hello,
> >
> > I am fighting with what I thought would be a straightforward problem. I
have
> > browsed the newsgroups for a while now but did not come up with an
answer.
> > The problem is as follows:
> >
> > I am trying to write a plug-in for a framework which generates GUIs for
(a
> > configurable subset of the) classes written on-the-fly
> > (www.nakedobjects.org). What I want to get at is a Smalltalk-like
experience
> > where you write code and have the code running and testable in a view at
the
> > same time (no runtime-workspace or the like). What I need for that is to
be
> > able to add (and replace) classes to the classpath of the plugin at
runtime.
> > I wrote a builder which does copy everything necessary to a place of my
> > choice (which would I guess be somewhere on the plugin-installation
path).
> > Now everything works fine within the PDE when I run my plug-in in a
> > runtime-workbench since that is actually looking at the
plug-in-project's
> > output-directory (which is where my builder puts the classes generated
from
> > the project within the runtime-workbench).
> >
> > Unfortunately, the same thing does not work when I install the plugin
and
> > try it from the standard Eclipse. I tried playing with both plugin.xml
as
> > well as manifest.mf but to no avail.
> >
> > An additional problem is obviously that I do not know any packages etc
at
> > build-time of the plugin...
> >
> > Any hints are highly appreciated.
> >
> > Thanks, cheers, Bastian
> >
> >
> >
Previous Topic:How to add URLs to a plugin/bundle classloader
Next Topic:Eclipse OSGi performance issue
Goto Forum:
  


Current Time: Thu Apr 25 10:20:24 GMT 2024

Powered by FUDForum. Page generated in 0.03095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top