Hi, until now I have used just a simple text editor to code plugins, but
things are starting to get more complex so I decided to install Eclipse (Mars.1 under linux). I managed to create a new project and import the ImageJ1 code and it runs fine. However I found 2 issues that I am not sure how to resolve: 1. This one is minor: running from Eclipse, the Help>About ImageJ does not show the background image as in the compiled version. Is that normal? If not, how do I resolve it? 2. I am stuck on how to create a new plugin with this setup. The tutorials online are for much older versions of Eclipse and things do not seem to be where they should. Do I just add a new Project? Do I add sub-folders under the /src/plugin/ folder? Do I need to create a new build folder for the plugins? Many thanks for any hints. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Gabriel,
I used the following detailed tutorial: http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:the_imagej_eclipse_howto Search for the following sentence in order to get to the part you're looking for: Create a new plugin (or import your previously developed plugins). Good luck, Avital On Mon, Nov 23, 2015 at 6:46 PM, Gabriel Landini <[hidden email]> wrote: > Hi, until now I have used just a simple text editor to code plugins, but > things are starting to get more complex so I decided to install Eclipse > (Mars.1 under linux). I managed to create a new project and import the > ImageJ1 > code and it runs fine. > > However I found 2 issues that I am not sure how to resolve: > > 1. This one is minor: running from Eclipse, the Help>About ImageJ does not > show the background image as in the compiled version. Is that normal? If > not, > how do I resolve it? > > 2. I am stuck on how to create a new plugin with this setup. The > tutorials > online are for much older versions of Eclipse and things do not seem to be > where they should. > Do I just add a new Project? Do I add sub-folders under the /src/plugin/ > folder? Do I need to create a new build folder for the plugins? > > Many thanks for any hints. > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Gabriel and Avital,
for developing a new plugin, this is a very good starting point: https://github.com/imagej/minimal-ij1-plugin/ When you import this project into Eclipse, you get a working maven project that inherits from ImageJ's parent project 'pom-imagej'. Best, Jan On 24.11.2015 06:35, Avital Steinberg wrote: > Hi Gabriel, > I used the following detailed tutorial: > > http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:the_imagej_eclipse_howto > > Search for the following sentence in order to get to the part you're > looking for: > > Create a new plugin (or import your previously developed plugins). > > Good luck, > Avital > > On Mon, Nov 23, 2015 at 6:46 PM, Gabriel Landini <[hidden email]> > wrote: > >> Hi, until now I have used just a simple text editor to code plugins, but >> things are starting to get more complex so I decided to install Eclipse >> (Mars.1 under linux). I managed to create a new project and import the >> ImageJ1 >> code and it runs fine. >> >> However I found 2 issues that I am not sure how to resolve: >> >> 1. This one is minor: running from Eclipse, the Help>About ImageJ does not >> show the background image as in the compiled version. Is that normal? If >> not, >> how do I resolve it? >> >> 2. I am stuck on how to create a new plugin with this setup. The >> tutorials >> online are for much older versions of Eclipse and things do not seem to be >> where they should. >> Do I just add a new Project? Do I add sub-folders under the /src/plugin/ >> folder? Do I need to create a new build folder for the plugins? >> >> Many thanks for any hints. >> Cheers >> >> Gabriel >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Avital & Gabriel,
I second Jan's suggestion to copy the minimal-ij1-plugin and use Maven. There are many advantages. The tutorial on the imagejdocu wiki is long and complex and less up-to-date. If you use Maven you will get source browsing for free, and dependency management nearly for free. See also these articles: * http://imagej.net/Introduction_into_Developing_Plugins#Getting_started_with_Maven * http://imagej.net/Writing_plugins The following video tutorial might also be informative, although it is a little outdated now too: * https://www.youtube.com/watch?v=XyfE_fVphCs Regards, Curtis On Tue, Nov 24, 2015 at 2:15 AM, Jan Eglinger <[hidden email]> wrote: > Hi Gabriel and Avital, > > for developing a new plugin, this is a very good starting point: > > https://github.com/imagej/minimal-ij1-plugin/ > > When you import this project into Eclipse, you get a working maven project > that inherits from ImageJ's parent project 'pom-imagej'. > > Best, > Jan > > > > On 24.11.2015 06:35, Avital Steinberg wrote: > >> Hi Gabriel, >> I used the following detailed tutorial: >> >> >> http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:the_imagej_eclipse_howto >> >> Search for the following sentence in order to get to the part you're >> looking for: >> >> Create a new plugin (or import your previously developed plugins). >> >> Good luck, >> Avital >> >> On Mon, Nov 23, 2015 at 6:46 PM, Gabriel Landini <[hidden email]> >> wrote: >> >> Hi, until now I have used just a simple text editor to code plugins, but >>> things are starting to get more complex so I decided to install Eclipse >>> (Mars.1 under linux). I managed to create a new project and import the >>> ImageJ1 >>> code and it runs fine. >>> >>> However I found 2 issues that I am not sure how to resolve: >>> >>> 1. This one is minor: running from Eclipse, the Help>About ImageJ does >>> not >>> show the background image as in the compiled version. Is that normal? If >>> not, >>> how do I resolve it? >>> >>> 2. I am stuck on how to create a new plugin with this setup. The >>> tutorials >>> online are for much older versions of Eclipse and things do not seem to >>> be >>> where they should. >>> Do I just add a new Project? Do I add sub-folders under the /src/plugin/ >>> folder? Do I need to create a new build folder for the plugins? >>> >>> Many thanks for any hints. >>> Cheers >>> >>> Gabriel >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >>> >>> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> >> > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Wednesday 25 Nov 2015 14:01:08 Curtis Rueden wrote:
> The following video tutorial might also be informative, although it is a > little outdated now too: https://www.youtube.com/watch?v=XyfE_fVphCs Hi thanks Curtis, I had a go at this. Dowloaded the ImageJA, imported the maven project into Eclipse, then somehow it compiled the source code under the git/ImageJA/target However, I do not see how to run the result from Eclipse, do I need to specify a launcher or a script file? Thanks Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Gabriel,
>I had a go at this. Dowloaded the ImageJA, imported the maven project into Eclipse, then somehow it compiled the source code under the git/ImageJA/target Maven outputs build artifacts (the .jar) in a special /target folder. If you want to run in Eclipse you actually don't need to worry about this output unless you want to distribute the .jar or test it in a Fiji installation (Eclipse will compile your code either when you tell it to launch an application, or continuously as changes are made). >However, I do not see how to run the result from Eclipse, do I need to specify a launcher or a script file? The goal for launching a program is typically "find the main method and run it."[1] In Fiji there are helper classes for launching with the appropriate classpath from Eclipse[2], and in ImageJ 1.x you can just run the main method in the ImageJ class[3]. Hope that helps. Best, Mark [1] http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FgettingStarted%2Fqs-12.htm [2] http://imagej.net/Developing_Fiji_in_Eclipse#Running_and_Debugging [3] https://github.com/imagej/ImageJA/blob/v1.50e/src/main/java/ij/ImageJ.java#L654 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
Hello Gabriel,
I have been working with Eclipse in combination with ImageJ with great satisfaction for many years, using a very simple setup that works flawlessly for all my students and on all types of computers (i.e., is fool-proof). I do not use Maven to keep things as simple as possible. The setup looks like this: * Use the <Image> directory as the root of the Eclipse project. * Include ij.jar in the Java build path (in Eclipse). * Place all additional libraries required into the (new) <ImageJ>/jars folder and include them in the Java build path. * Create a source folder 'src' to hold the plugin code. Set up <ImageJ>/plugins as its output folder. * In 'src' I usually create Java packages (max. 1 level deep) for structuring your plugins. A complete Eclipse project setup like this can be downloaded here: https://www.dropbox.com/s/rp36c95xlj23ljo/ImageJ-Eclipse-Project.zip?dl=0 I usually do not launch ImageJ from within Eclipse but run both side by side. This allows a very efficient edit-compile-run cycle. If you need to start ImageJ under Eclipse's "umbrella" (e.g. to set breakpoints and inspect the runtime stack) this can be done easily with a small helper class or running ImageJ's main() method. Which I never found to be necessary though... Hope this is of any help. There is no substitute for a proper IDE, compile-time safety etc., I am sure you will never want to miss it again. Best regards, Wilhelm www.imagingbook.com -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel Landini Sent: Mittwoch, 02. Dezember 2015 14:40 To: [hidden email] Subject: Re: Eclipse woes On Wednesday 25 Nov 2015 14:01:08 Curtis Rueden wrote: > The following video tutorial might also be informative, although it is > a little outdated now too: https://www.youtube.com/watch?v=XyfE_fVphCs Hi thanks Curtis, I had a go at this. Dowloaded the ImageJA, imported the maven project into Eclipse, then somehow it compiled the source code under the git/ImageJA/target However, I do not see how to run the result from Eclipse, do I need to specify a launcher or a script file? Thanks Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Mark Hiner
On Wednesday 02 Dec 2015 08:41:02 you wrote:
> The goal for launching a program is typically "find the main method and run > it."[1] In Fiji there are helper classes for launching with the appropriate > classpath from Eclipse[2], and in ImageJ 1.x you can just run the main > method in the ImageJ class[3]. Thanks Mark, I found the way to run the project now. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Burger Wilhelm
On Wednesday 02 Dec 2015 15:12:07 Burger Wilhelm wrote:
> I have been working with Eclipse in combination with ImageJ with great > satisfaction for many years, using a very simple setup that works > flawlessly for all my students and on all types of computers (i.e., is > fool-proof). I do not use Maven to keep things as simple as possible. Many thanks Wilhelm, I will look at your suggestions too. I found that the tutorials out there are either for somebody with experience using Eclipse (obviously not me) or for previous versions. It appears that some things are in different places and takes me some time to find. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Burger Wilhelm
>I usually do not launch ImageJ from within Eclipse but run both side by
side. This allows a very efficient edit-compile-run cycle. I second this! >I do not use Maven to keep things as simple as possible. I see the complexity of Maven as a fixed cost. If you have a simple project and dependency structure it may not make sense to use Maven. As your complexity grows, paying the Maven cost begins to be more and more reasonable. >The setup looks like this: I like what you're doing here to minimize the hassle of copying jars! I just want to add that you are supposed to be able to do this in a general way, for every Mavenized ImageJ project, and also automatically copy dependencies and clean up duplicate versions.[1] [1] http://imagej.net/index.php?title=Developing_Fiji_in_Eclipse&oldid=18706#Option_2:_Install_dependencies On Wed, Dec 2, 2015 at 9:12 AM, Burger Wilhelm < [hidden email]> wrote: > Hello Gabriel, > > I have been working with Eclipse in combination with ImageJ with great > satisfaction for many years, using a very simple setup that works > flawlessly for all my students and on all types of computers (i.e., is > fool-proof). I do not use Maven to keep things as simple as possible. > > The setup looks like this: > * Use the <Image> directory as the root of the Eclipse project. > * Include ij.jar in the Java build path (in Eclipse). > * Place all additional libraries required into the (new) <ImageJ>/jars > folder and include them in the Java build path. > * Create a source folder 'src' to hold the plugin code. Set up > <ImageJ>/plugins as its output folder. > * In 'src' I usually create Java packages (max. 1 level deep) for > structuring your plugins. > > A complete Eclipse project setup like this can be downloaded here: > https://www.dropbox.com/s/rp36c95xlj23ljo/ImageJ-Eclipse-Project.zip?dl=0 > > I usually do not launch ImageJ from within Eclipse but run both side by > side. This allows a very efficient edit-compile-run cycle. > If you need to start ImageJ under Eclipse's "umbrella" (e.g. to set > breakpoints and inspect the runtime stack) this can be done easily with a > small helper class or running ImageJ's main() method. Which I never found > to be necessary though... > > Hope this is of any help. There is no substitute for a proper IDE, > compile-time safety etc., I am sure you will never want to miss it again. > > Best regards, > Wilhelm > > www.imagingbook.com > > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of > Gabriel Landini > Sent: Mittwoch, 02. Dezember 2015 14:40 > To: [hidden email] > Subject: Re: Eclipse woes > > On Wednesday 25 Nov 2015 14:01:08 Curtis Rueden wrote: > > The following video tutorial might also be informative, although it is > > a little outdated now too: https://www.youtube.com/watch?v=XyfE_fVphCs > > Hi thanks Curtis, > I had a go at this. Dowloaded the ImageJA, imported the maven project into > Eclipse, then somehow it compiled the source code under the > git/ImageJA/target > > However, I do not see how to run the result from Eclipse, do I need to > specify a launcher or a script file? > > Thanks > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
Hi Gabriel,
I basically use the same strategy as Wilhelm. I typically code a main method so that I could start ImageJ from Eclipse by defining a launcher public static void main(String[] args) { try { File f=new File(args[0]); if (f.exists() && f.isDirectory() ) { System.setProperty("plugins.dir", args[0]); new ImageJ(); } else { throw new IllegalArgumentException(); } } catch (Exception ex) { IJ.log("plugins.dir misspecified\n"); ex.printStackTrace(); } } I run 2 copies of ImageJ - a development copy and a testing copy. best regards, Dimiter -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 2015-12-03 09:06, Dimiter Prodanov wrote:
> Hi Gabriel, > > I basically use the same strategy as Wilhelm. > I typically code a main method so that I could start ImageJ from Eclipse by > defining a launcher > > public static void main(String[] args) { > try { > File f=new File(args[0]); > if (f.exists() && f.isDirectory() ) { > System.setProperty("plugins.dir", args[0]); > new ImageJ(); > } else { > throw new IllegalArgumentException(); > } > } > catch (Exception ex) { > IJ.log("plugins.dir misspecified\n"); > ex.printStackTrace(); > } > } Another very convenient way to launch ImageJ from within Eclipse for simple projects without Maven is to define ImageJ either as an external JAR or user library: Project > Properties > Java Build Path > choose the Libraries tab > Add External JARs... and specify the path to ij.jar (you may use your normal ImageJ path). You can even define ImageJ as User Library (Add Library...) and/or attach source/javadocs to the external JAR/library. Then, make a run configuration: Project > Properties > Run/Debug Settings > New... (click Java Application) In the "Main" tab of the dialog popping up, clicck "Search" to find the main class of the ij.jar defined as external JAR/library. Eclipse will find ij.ImageJ. In the "Arguments" tab, pass the ImageJ "-run" command to launch your plugin: -run "NameOfMyPlugin" You can give more arguments (-ijpath to specify the plugin directory, -macro to run a macro to load a sample image before calling your plugin etc.). Exceptions and System.out messages are redirected to the console in Eclipse. Best, Thomas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi everyone,
All of these approaches are fine... until you want to share your code with others. Using Maven avoids IDE lock-in. Others can use whichever tool they prefer to easily build, develop and run your code. It is super easy to import a Maven project into your IDE and just go—or to build it from the command line with one simple command. With the non-Maven approaches, you have to, at minimum, commit your Eclipse metadata files (.classpath, .project, .settings) and also commit all your dependencies (JAR files your plugin uses). Or else require your collaborators to manually download and link in those same dependencies to Eclipse. If you are serious about creating something reusable by others, onto which the community can build and contribute further, I would strongly suggest using a project management system such as Maven or Gradle. Regards, Curtis P.S. See also http://imagej.net/Distribution On Thu, Dec 3, 2015 at 4:04 AM, Peterbauer Thomas < [hidden email]> wrote: > On 2015-12-03 09:06, Dimiter Prodanov wrote: > > Hi Gabriel, > > > > I basically use the same strategy as Wilhelm. > > I typically code a main method so that I could start ImageJ from Eclipse > by > > defining a launcher > > > > public static void main(String[] args) { > > try { > > File f=new File(args[0]); > > if (f.exists() && f.isDirectory() ) { > > System.setProperty("plugins.dir", args[0]); > > new ImageJ(); > > } else { > > throw new IllegalArgumentException(); > > } > > } > > catch (Exception ex) { > > IJ.log("plugins.dir misspecified\n"); > > ex.printStackTrace(); > > } > > } > > Another very convenient way to launch ImageJ from within Eclipse for > simple projects without Maven is to define ImageJ either as an external > JAR or user library: > > Project > Properties > Java Build Path > choose the Libraries tab > Add > External JARs... > > and specify the path to ij.jar (you may use your normal ImageJ path). > You can even define ImageJ as User Library (Add Library...) and/or > attach source/javadocs to the external JAR/library. > > Then, make a run configuration: > > Project > Properties > Run/Debug Settings > New... (click Java Application) > > In the "Main" tab of the dialog popping up, clicck "Search" to find the > main class of the ij.jar defined as external JAR/library. Eclipse will > find ij.ImageJ. > > In the "Arguments" tab, pass the ImageJ "-run" command to launch your > plugin: > > -run "NameOfMyPlugin" > > You can give more arguments (-ijpath to specify the plugin directory, > -macro to run a macro to load a sample image before calling your plugin > etc.). Exceptions and System.out messages are redirected to the console > in Eclipse. > > Best, > Thomas > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Curtis,
Yes - this is super important. The bottom line is whether or not people can use it, and quite often, for it to be useful it has to be tweaked a little. Thanks for sharing your knowledge with us, Avital On Thu, Dec 3, 2015 at 7:28 PM, Curtis Rueden <[hidden email]> wrote: > Hi everyone, > > All of these approaches are fine... until you want to share your code with > others. > > Using Maven avoids IDE lock-in. Others can use whichever tool they prefer > to easily build, develop and run your code. It is super easy to import a > Maven project into your IDE and just go—or to build it from the command > line with one simple command. > > With the non-Maven approaches, you have to, at minimum, commit your Eclipse > metadata files (.classpath, .project, .settings) and also commit all your > dependencies (JAR files your plugin uses). Or else require your > collaborators to manually download and link in those same dependencies to > Eclipse. > > If you are serious about creating something reusable by others, onto which > the community can build and contribute further, I would strongly suggest > using a project management system such as Maven or Gradle. > > Regards, > Curtis > > P.S. See also http://imagej.net/Distribution > > On Thu, Dec 3, 2015 at 4:04 AM, Peterbauer Thomas < > [hidden email]> wrote: > > > On 2015-12-03 09:06, Dimiter Prodanov wrote: > > > Hi Gabriel, > > > > > > I basically use the same strategy as Wilhelm. > > > I typically code a main method so that I could start ImageJ from > Eclipse > > by > > > defining a launcher > > > > > > public static void main(String[] args) { > > > try { > > > File f=new File(args[0]); > > > if (f.exists() && f.isDirectory() ) { > > > System.setProperty("plugins.dir", args[0]); > > > new ImageJ(); > > > } else { > > > throw new IllegalArgumentException(); > > > } > > > } > > > catch (Exception ex) { > > > IJ.log("plugins.dir misspecified\n"); > > > ex.printStackTrace(); > > > } > > > } > > > > Another very convenient way to launch ImageJ from within Eclipse for > > simple projects without Maven is to define ImageJ either as an external > > JAR or user library: > > > > Project > Properties > Java Build Path > choose the Libraries tab > Add > > External JARs... > > > > and specify the path to ij.jar (you may use your normal ImageJ path). > > You can even define ImageJ as User Library (Add Library...) and/or > > attach source/javadocs to the external JAR/library. > > > > Then, make a run configuration: > > > > Project > Properties > Run/Debug Settings > New... (click Java > Application) > > > > In the "Main" tab of the dialog popping up, clicck "Search" to find the > > main class of the ij.jar defined as external JAR/library. Eclipse will > > find ij.ImageJ. > > > > In the "Arguments" tab, pass the ImageJ "-run" command to launch your > > plugin: > > > > -run "NameOfMyPlugin" > > > > You can give more arguments (-ijpath to specify the plugin directory, > > -macro to run a macro to load a sample image before calling your plugin > > etc.). Exceptions and System.out messages are redirected to the console > > in Eclipse. > > > > Best, > > Thomas > > > > > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
Just use maven and be happy.
But if u can use intellij ide u will be happier! :) Em segunda-feira, 23 de novembro de 2015, Gabriel Landini < [hidden email]> escreveu: > Hi, until now I have used just a simple text editor to code plugins, but > things are starting to get more complex so I decided to install Eclipse > (Mars.1 under linux). I managed to create a new project and import the > ImageJ1 > code and it runs fine. > > However I found 2 issues that I am not sure how to resolve: > > 1. This one is minor: running from Eclipse, the Help>About ImageJ does not > show the background image as in the compiled version. Is that normal? If > not, > how do I resolve it? > > 2. I am stuck on how to create a new plugin with this setup. The > tutorials > online are for much older versions of Eclipse and things do not seem to be > where they should. > Do I just add a new Project? Do I add sub-folders under the /src/plugin/ > folder? Do I need to create a new build folder for the plugins? > > Many thanks for any hints. > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- [image: http://www.infosolo.com.br/novo/logoInfosoloEmail.png] *David Reis* Fabrica de Software - Consultor [hidden email] http://www.infosolo.com.br <http://www.infosolo.com.br/novo/> Fones: (61) 3323-6808 - (61) 9668-3742 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |