Skip to content, Skip to search


Downloading and Building Fiji From Source

111 bytes added, 09:15, 9 July 2019
Add step about installing OpenJDK 8
== Downloading {{FijiMenu}}The complete Fiji distribution of ImageJ consists of over a hundred individual components. Most of these components are ImageJ [[plugins]]; the Source Code with Git ==rest are core libraries, [[scripts]] and several other resources (such as the [[:File:Fiji-icon.png|Fiji logo]] and the README).
''Warning: In the past, Fiji used to be built from one monolithic source code for repository, which became unmanageable over time. These days, therefore, developers start from a fully-populated ''Fiji is rather large; make sure that you have two gigabytes of disk space free before beginning''directory and build only the parts they would like to change.
To fetch the = Download Fiji source code you should use [ git] (Windows users, please go [ here]). If you are not familiar with Git, you might want to read [[Git mini howto|this page]] or [[:Category:Git|these pages]] instead.=
==== Cloning source as unknown contributor ====Your The first step should be to "clone" is the fiji repository with same for developers as it is for users: [[Downloads|Download]] Fiji, and unpack it. The Desktop is the following command:recommended location.
git clone Install Java =
This should start downloading the base fiji repository and unpack it into The next step is to install [ OpenJDK 8]. You will need a directory called "fiji" JDK in your current directory. Once this has successfully completed, change into the newly created "fiji" directoryorder to develop Java code.
'''If this clone is slow''', you might want to try to clone from, = Check out and after that switch back to the official repository:build individual plugins/libraries =
git clone git://githubTo develop a plugin, the developer first needs to find out in which file it is cd fiji git config remoteTo do that, simply call the ''Command Finder'' (shortcut {{key press|Ctrl|L}}), type (part of) the label of the menu entry in whose function you are interested, and look at the ''File'' column.origin.url git:// git pull
If you Each individual component is maintained in its own repository in the [ ''fiji'' org on GitHub]. The name of the repository corresponding to a given ''.jar'' file is essentially identical with the file name, except that trailing underscores are getting errors like thisstripped. Example: ''Stitching_.jar'' is maintained in the repository at, ''Time_Lapse.jar'' in the repository at
githubIf in doubt about the location of the repository, just call {{bc | Plugins | Debug | System Information}} and find the section corresponding to the file in[0:]: errno=Connection timed out fatal: unable to connect a socket (Connection timed out)
then you probably are behind a firewall that does not let you connect Once the developer has identified which plugin or library she wants to modify or develop further, it is very easy to port 9418. build and contribute by following [[http://en.wikipediaHow to contribute to an existing plugin or library|this tutorial]].org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy Do not panic], though, you might be able to clone the repository with
git clone Example ==
orLet's assume that we want to develop the Skeletonize3D plugin. Its source code is maintained at The first step is to clone the source code:
<source lang="bash">$ git clone into 'Skeletonize3D'...remote: Counting objects: 115, done.remote: Compressing objects: 100% (58/58), done.remote: Total 115 (delta 46), reused 115 (delta 46)Receiving objects: 100% (115/115), 22.81 KiB | 0 bytes/s, done.Resolving deltas: 100% (46/46), done.Checking connectivity... done.git</source>
You only need to type the part after the ''$'' prompt, i... where e you should replace would type <ttcode>yourusernamegit clone</ttcode> with your GitHub username. The rest is shown only for reference, so that you know what to expect.
==== Cloning source as known contributor ====The above Then let's use the command creates a unknown contributor copy of Fiji in your computer. If you have your own user account in, then you should clone fiji with -line Maven to build the following command: git clone ''username''@fiji.scproject:/srv/git/fiji.git
Just substitute ''username'' with your corresponding user name on that machine<source lang="bash">$ cd Skeletonize3D/$ mvn[INFO] Scanning for projects...[... lots and lots of interesting and useful information ...][INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 52.574s[INFO] Finished at: Tue Dec 02 10:27:00 CET 2014[INFO] Final Memory: 20M/81M[INFO] ------------------------------------------------------------------------</source>
=== Submodules ===And finally, let's build the project and install it into the '''' directory:
Some plugins are managed as submodules<source lang="bash">$ mvn$HOME/Desktop/ -Ddelete.other.versions=true[INFO] Scanning for projects...[... If you want to work on them, you will have to initialize lots and lots of interesting and update themuseful information ...][INFO][INFO] --- imagej-maven-plugin:0.5. 4:copy-jars (For more on submodules, see the copy-jars) @ Skeletonize3D_ ---[INFO] Copying Skeletonize3D_-1.0.2-SNAPSHOT.jar to $HOME/Desktop/[Git submodule tutorialINFO]Deleted overridden Skeletonize3D_-1.0.1.jar[INFO]Copying ij-1.49j.) For example, if you know that you're going jar to need to work on the <tt>ImageJA<$HOME/Desktop/>, <tt>TrakEM2<jars[INFO] Deleted overridden ij-1.49m.jar[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 21.331s[INFO] Finished at: Tue Dec 02 10:30:02 CET 2014[INFO] Final Memory: 14M/tt> and <tt>mpicbg81M[INFO] ------------------------------------------------------------------------</ttsource> submodules, you should initialize and update them with the following commands:
git submodule init modules/ImageJA modules/TrakEM2 modules/mpicbg git submodule updateOf course, this assumes that you followed the suggestion and unpacked your Fiji onto the Desktop. If you unpacked it somewhere else, you ''have'' to adjust the command-line accordingly.
Note that the exact dependency versions, as specified by the project in the ''pom.xml'Note:'file, are copied into the '' in the common case, you do not need <u>any</u> submodule to be checked out (except the Java submodule, which will be checked out automatically once you run the [[Fiji Build System|Fiji Build]] with:  .app/ Note: using <b>git submodule update</b> without specifying which submodule'' directory, will update <b>all</b> submodulespossibly replacing other versions. What <i>update</i> means: "put all submodules, if checked out, to the last commit that was committed in the fiji repos". Which is most likely not what you want--You will put any submodule that you have been working on into a <b>(no branch)</b> situation. To fix it, just cd to that submodule <i>git checkout master</i> or whatever branch you were working on. Alternately, if you want to automatically clone, configure and/or update a submodule with all its dependent submodules, you can run (e.g., for TrakEM2):  cd bin ./ TrakEM2 === Getting a snapshot without Git === If you insist on not using Git, you can download a snapshot of Fiji [;a=snapshot;h=master;sf=tgz here], but you need to make sure that you have a new enough Java version installed. == Building Fiji from Source== You should now be able to build Fiji with:  sh run ... which will invoke Fiji's multiuse not-platform build system. If all goes well, after some time you should see the main Fiji window: [[Image:Fijitoo-main-window.png|Fiji's main window]]   === Multi-platform build confirmed successes === Typically, multi-platform is plain hell. As today (June 2012), [[User:Schindelin|Johannes Schindelin]] put enough effort to ensure that Fiji builds '''at the very least''' on different versions from the following systems: * Linux * Windows 64-bit with [http://msysgitcurrent MSysGit]* Windows 64-bit using [ Cygwin] * MacOS X 10.5 (Leopard)* MacOS X 10.7 (Lion) === Missing Java3D === During the build process there might be complaints about missing Java3D features if you already have a Java SDK installed. To force the build system to clone a JDK with everything needed by Fiji (including Java3D support) you need to clear the environment variable ''JAVA_HOME'' before building: <code lang="bash">unset JAVA_HOME</code>
Bureaucrat, emailconfirmed, incoming, administrator, uploaders