Skip to content, Skip to search

Changes

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 this.app/''directory and build only the parts they would like to change.
To fetch the = Download Fiji source code you should use [http://git.or.cz/ git] (Windows users, please go [http://msysgit.googlecode.com 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 contrib@fiji.sc:/srv/git/fiji.git= Install Java =
This should start downloading the base fiji repository and unpack it into The next step is to install [https://adoptopenjdk.net/ 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 github.com, = 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 contained.com/fiji/fiji 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://fiji.sc/fiji.git git pull
If you Each individual component is maintained in its own repository in the [https://github.com/fiji/ ''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 https://github.com/fiji/Stitching, ''Time_Lapse.jar'' in the repository at https://github.com/fiji/Time_Lapse.
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 question.com[0: 207.97.227.239]: 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 contrib@fiji.sc:/srv/git/fiji.git== Example ==
orLet's assume that we want to develop the Skeletonize3D plugin. Its source code is maintained at https://github.com/fiji/Skeletonize3D. The first step is to clone the source code:
<source lang="bash">$ git clone https://yourusername@github.com/fiji/fijiSkeletonize3DCloning 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 https://github.com/fiji/Skeletonize3D</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 fiji.sc, 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 ''Fiji.app/'' directory:
Some plugins are managed as submodules<source lang="bash">$ mvn -Dimagej.app.directory=$HOME/Desktop/Fiji.app/ -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/Fiji.app/plugins[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/Fiji.app/tt>, <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/Build.sh 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 ./configure-submodule.py TrakEM2 === Getting a snapshot without Git === If you insist on not using Git, you can download a snapshot of Fiji [http://fiji.sc/cgi-bin/gitweb.cgi?p=fiji.git;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 Build.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 versions.github.com/ MSysGit]* Windows 64-bit using [http://www.cygwin.com/ 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>
[[Category:Development]]
[[Category:Fiji]]
Bureaucrat, emailconfirmed, incoming, administrator, uploaders
11,842
edits