fundamental question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fundamental question

Tony Shepherd
Total beginner here, so any help will make a big difference!..

I'm trying to edit existing classes in ImageJ. I start with the
image-processing demo plugin. I can re-name it, edit button labels and loop
controls etc, no problem.

If I want to go much further I will have to edit the super-classes (won't I?).
I find that MYPLUGIN extends PlugInFrame.
Reading ij.jar tells me that PlugInFrame.java is in ij/plugin/frame/
Indeed, that's where it is in the unzipped source-code folders, but editing
tit there doesn't do anything.

I try copying the source code from source/ij/plugin/frame/ into the same
directory as MYPLUGIN.java, and re-naming it to MYPLUGINFrame, then editing
accordingly: MYPLUGIN extends MYPLUGINFrame,
similarly
‘public class PlugInFrame’
becomes
‘public class MYPLUGINFrame

This is obviously not right (the compiler can't find MYPLUGINFrame)

Can someone point me in the right direction?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: fundamental question

ctrueden
Hi Tony,

On 8/8/06, Tony Shepherd <[hidden email]> wrote:

>
> Total beginner here, so any help will make a big difference!..
>
> I'm trying to edit existing classes in ImageJ. I start with the
> image-processing demo plugin. I can re-name it, edit button labels and
> loop
> controls etc, no problem.
>
> If I want to go much further I will have to edit the super-classes (won't
> I?).
> I find that MYPLUGIN extends PlugInFrame.
> Reading ij.jar tells me that PlugInFrame.java is in ij/plugin/frame/
> Indeed, that's where it is in the unzipped source-code folders, but
> editing
> tit there doesn't do anything.


First of all, ImageJ has been created with a modular design such that you
shouldn't need to be editing PlugInFrame for most purposes. I am also not
sure what you mean by "further." What are you trying to accomplish?

However, if you have a good reason (e.g., if you are doing so to educate
yourself about Java), it comes down to a classpath issue, like most Java
compilation problems. PlugInFrame is part of the ij.plugin.frame package,
meaning it needs to be contained in directory structure ij/plugin/frame.
Your classpath needs to include the folder containing the ij folder so that
the Java compiler knows where to look. Also note that if you include
ij.jarin your classpath, it must appear *after* the directory
containing your
modified source, or else it will use the version stored in the JAR file
instead, and your changes will not be recognized.

I try copying the source code from source/ij/plugin/frame/ into the same
> directory as MYPLUGIN.java, and re-naming it to MYPLUGINFrame, then
> editing
> accordingly: MYPLUGIN extends MYPLUGINFrame,
> similarly
> 'public class PlugInFrame'
> becomes
> 'public class MYPLUGINFrame


You should not have to copy the source code. Just include the "source"
folder in your classpath. For example, on Linux, if the ImageJ source is at
/home/me/source, you would type:
    export CLASSPATH=/home/me/source
(on Windows, "set CLASSPATH=C:\ImageJ\source" or wherever you put it).

You can also accomplish this as part of the call to javac with the "-cp"
command line argument:
    javac -cp /home/me/source *.java

This is obviously not right (the compiler can't find MYPLUGINFrame)
>
> Can someone point me in the right direction?
>
> Thanks
>

-Curtis
Reply | Threaded
Open this post in threaded view
|

Re: fundamental question

Dimiter Prodanov
In reply to this post by Tony Shepherd
>Hi,

it' s better to start with some primer on Java programing.
there are a lot of them free on the web.
Generally, you have to update the contents of the jar file
in order for the "editing" to take effect.

cheers


_______________________________________________________________________
Dr Dimiter Prodanov, MD, Ph.D.

Neural Engineering Rehabilitation Laboratory
(Laboratoire de Génie de la Réhabilitation Neurale)
Département de Physiologie et Pharmacologie
Université catholique de Louvain
Avenue Hippocrate, 54
POBox UCL-5446 / B-1200 Bruxelles -Belgique-
Phone: 00-322-764 5596
Fax: 00-322-764 9422

http://www.md.ucl.ac.be/gren