Login  Register

Re: fundamental question

Posted by ctrueden on Aug 08, 2006; 6:15pm
URL: http://imagej.273.s1.nabble.com/fundamental-question-tp3701864p3701866.html

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