Skip to content, Skip to search

Changes

Downloading and Building Fiji From Source

276 bytes removed, 09:15, 9 July 2019
Add step about installing OpenJDK 8
<div style="background:#ffd{{FijiMenu}}The complete Fiji distribution of ImageJ consists of over a hundred individual components. Most of these components are ImageJ [[plugins]]; paddingthe rest are core libraries, [[scripts]] and several other resources (such as the [[: 10px 10px 0 10px; borderFile: 1px solid black;"><b>Please note!</b> This page is rather outdated now, Fiji-icon.png|Fiji logo]] and in need of updatethe README).</div>
== Downloading In the Source Code with Git ==past, Fiji used to be built from one monolithic source code repository, which became unmanageable over time. These days, therefore, developers start from a fully-populated ''Fiji.app/'' directory and build only the parts they would like to change.
''Warning: the source code for = Download Fiji is rather large; make sure that you have two gigabytes of disk space free before beginning this.''=
To fetch The first step is the Fiji source code you should use [http://git.or.cz/ git] (Windows same for developers as it is for users, please go [http://msysgit.googlecode.com here]). If you are not familiar with Git, you might want to read [[Git mini howtoDownloads|this pageDownload]] or [[:Category:Git|these pages]] insteadFiji, and unpack it. The Desktop is the recommended location.
=Install Java === Cloning source as unknown contributor ====Your first step should be to "clone" the fiji repository with the following command:
git clone contrib@fiji.scThe next step is to install [https:/srv/gitadoptopenjdk.net/fijiOpenJDK 8]. You will need a JDK in order to develop Java code.git
This should start downloading the base fiji repository = Check out and unpack it into a directory called "fiji" in your current directory. Once this has successfully completed, change into the newly created "fiji" directory.build individual plugins/libraries =
To develop a plugin, the developer first needs to find out in which file it is contained. To do that, simply call the '''If this clone is slow'Command Finder''(shortcut {{key press|Ctrl|L}}), type (part of) the label of the menu entry in whose function you might want to try to clone from github.comare interested, and after that switch back to look at the official repository:''File'' column.
git clone gitEach individual component is maintained in its own repository in the [https://github.com/fiji/''fiji cd fiji git config remote'' 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 stripped.originExample: ''Stitching_.url gitjar'' is maintained in the repository at https://github.com/fiji/Stitching, ''Time_Lapse.jar'' in the repository at https://github.sccom/fiji/Time_Lapse.git git pull
If you are getting errors like this: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.
github.comOnce the developer has identified which plugin or library she wants to modify or develop further, it is very easy to build and contribute by following [[0: 207.97.227How to contribute to an existing plugin or library|this tutorial]].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 to port 9418. [http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy Do not panic], though, you might be able to clone the repository with== Example ==
git clone contrib@fijiLet's assume that we want to develop the Skeletonize3D plugin.scIts source code is maintained at https:/srv/gitgithub.com/fiji/Skeletonize3D.gitThe first step is to clone the source code:
or<source lang="bash">$ git clone https://github.com/fiji/Skeletonize3DCloning 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.</source>
You only need to type the part after the ''$'' prompt, i.e you would type <code>git clone https://yourusername@github.com/fiji/fijiSkeletonize3D</code>. The rest is shown only for reference, so that you know what to expect.git
... where you should replace <tt>yourusername</tt> with your GitHub username.Then let's use the command-line Maven to build the project:
==== Cloning <source as known contributor ===lang="bash">$ cd Skeletonize3D/$ mvn[INFO] Scanning for projects...The above command creates a unknown contributor copy [... lots and lots of Fiji in your computerinteresting and useful information .. If you have your own user account in fiji.sc, then you should clone fiji with the following command][INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time:52.574s [INFO] Finished at: Tue Dec 02 10:27:00 CET 2014 git clone ''username''@fiji.sc[INFO] Final Memory:20M/srv81M[INFO] ------------------------------------------------------------------------</git/fiji.gitsource>
Just substitute And finally, let's build the project and install it into the 'username'Fiji.app/' with your corresponding user name on that machine.' directory:
<source lang="bash">$ mvn -Dimagej.app.directory=$HOME/Desktop/Fiji.app/ -Ddelete.other.versions= Submodules ===true[INFO] Scanning for projects...[... lots and lots of interesting and useful information ...][INFO][INFO] --- imagej-maven-plugin:0.5.4:copy-jars (copy-jars) @ Skeletonize3D_ ---[INFO] Copying Skeletonize3D_-1.0.2-SNAPSHOT.jar to $HOME/Desktop/Fiji.app/plugins[INFO] Deleted overridden Skeletonize3D_-1.0.1.jar[INFO] Copying ij-1.49j.jar to $HOME/Desktop/Fiji.app/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/81M[INFO] ------------------------------------------------------------------------</source>
Some plugins are managed as submodules. If you want to work on themOf course, this assumes that you will have to initialize followed the suggestion and update them. (For more on submodules, see unpacked your Fiji onto the [[Git submodule tutorial]]Desktop.) For exampleIf you unpacked it somewhere else, if you know that you're going 'have'' to need to work on adjust the <tt>ImageJA</tt>, <tt>TrakEM2</tt> and <tt>mpicbg</tt> submodules, you should initialize and update them with the following commands:command-line accordingly.
git submodule init modules/ImageJA modules/TrakEM2 modules/mpicbg modules/imglib git submodule update 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 multi-platform build system. If all goes well, after some time you should see the main Fiji window: [[Image:Fijiuse not-maintoo-window.png|Fiji's main window]]   === Multi-platform build confirmed successes === Typically, multi-platform is plain hell. As of June 2012, [[User:Schindelin|Johannes Schindelin]] put enough effort to ensure that Fiji builds '''at the very least''' on the following systems: * Linux 32-bit with [http://www.ubuntu.com/ Ubuntu]* Linux 64-bit with [http://www.ubuntu.com/ Ubuntu] * Windows 64-bit with [http://msysgit.github.com/ MSysGit]* Windows 64-bit using [http://www.cygwin.com/ Cygwin] (you will need at least the <tt>curl</tt> & <tt>unzip</tt> functions to be installed) * MacOSX 10.5 (Leopard)* MacOSX 10.6 (Snow Leopard)* MacOSX 10.7 (Lion) === Missing Java3D === During different versions from the build process there might be complaints about missing Java3D features if you already have a Java SDK installedcurrent versions. 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