- Installation
- Memory
- Upgrading
- Sharing the Java Runtime
- Compiling Plugins
- Command Line Options
- Creating a Gnome Launcher
- Troubleshooting
- Screenshot
Installation
To install and run ImageJ, download ImageJ bundled with either 32-bit or 64-bit Java, extract the ImageJ directory, change to the ImageJ directory and double click the 'run' script.Memory
To make more than 256MB of memory available to ImageJ, edit the 'run' script. For example, changing the script tomakes 512MB available to ImageJ. To make more than 2GB available to ImageJ requires a 64-bit computer running a 64-bit version of Linux and a 64-bit version of Java../jre/bin/java -Xmx512m -jar ij.jarUpgrading
Use the Help>Update ImageJ command to update to the latest version of ImageJ.Sharing the Java Runtime
You can specify the location of the plugins directory from the command line using the -ijpath option. This allows ImageJ to be in a common location (e.g., /usr/local/ImageJ) and run from the users home directory using a shell script. This example runs ImageJ from /usr/local/ImageJ using a plugins directory at /home/wayne/ImageJ/plugins:This example uses Java 1.6 SDK to run ImageJ from /usr/local/ImageJ with the plugin directory also located in /usr/local/ImageJ:cd /usr/local/ImageJ ./jre/bin/java -Xmx512m -jar ij.jar -ijpath /home/wayne/ImageJFor the Plugins>Compile and Run command to work, you may need to put a copy of javac.jar in the /usr/java/jdk1.6/lib/ext directory. The javac.jar file is included with the Linux distributions of ImageJ, in the ImageJ/jre/lib/ext directory./usr/java/jdk1.6/bin/java -Xmx512m -jar /usr/local/ImageJ/ij.jar -ijpath /usr/local/ImageJCompiling Plugins
The Plugins>Compile and Run command uses the javac compiler contained in the tools.jar file included with the Java Development Kit (JDK). The Java runtime included with the Linux distributions of ImageJ include tools.jar (or a stripped down version called javac.jar) as a Java extension in ImageJ/jre/lib/ext. Users who install the JDK separately must either add tools.jar to the command line, for example:or copy tools.jar to the Java extensions directory at, for example:java -Xmx200m -cp ij.jar:/usr/local/jdk1.6/lib/tools.jar ij.ImageJ/usr/local/jdk1.6/jre/lib/ext/Command Line Options
ImageJ recognizes the following command line options:"file-name" Opens a file Example 1: blobs.tif Example 2: /Users/wayne/images/blobs.tif Example 3: e81*.tif -macro path [arg] Runs a macro or script (JavaScript, BeanShell or Python), passing an optional string argument, which the macro or script can be retrieve using the getArgument() function. The macro or script is assumed to be in the ImageJ/macros folder if 'path' is not a full directory path. Example 1: -macro analyze.ijm Example 2: -macro script.js /Users/wayne/images/stack1 Example 2: -macro script.py '1.2 2.4 3.8' -batch path [arg] Runs a macro or script (JavaScript, BeanShell or Python) in batch (no GUI) mode, passing it an optional argument. ImageJ exits when the macro finishes. -eval "macro code" Evaluates macro code Example 1: -eval "print('Hello, world');" Example 2: -eval "return getVersion();" -run command Runs an ImageJ menu command Example: -run "About ImageJ..." -ijpath path Specifies the path to the directory containing the plugins directory Example: -ijpath /Applications/ImageJ -portSpecifies the port ImageJ uses to determine if another instance is running Example 1: -port1 (use default port address + 1) Example 2: -port2 (use default port address + 2) Example 3: -port0 (don't check for another instance) -debug Runs ImageJ in debug mode Creating a Gnome (Ubuntu) Launcher
Edit the file named 'run' in the ImageJ directory, changing it to eitherif using the Java bundled with the ImageJ distribution or to~/ImageJ/jre/bin/java -Xmx512m -jar ~/ImageJ/ij.jar -ijpath ~/ImageJif using the Java installed on your system. Note, these examples assume that the ImageJ directory is in your home directory.java -Xmx512m -jar ~/ImageJ/ij.jar -ijpath ~/ImageJNext make sure the file executable:
Then follow these steps:$ cd ~/ImageJ/ $ chmod +x runAlternatively, the System>Preferences>Menus & Toolbars command will let you add a menu entry in the Gnome menus.
- If it is not already in the ImageJ directory, download the icon at rsb.info.nih.gov/ij/images/ImageJ.png.
- Copy it to /usr/share/pixmaps.
- In the Gnome panel, at the top of the screen, right click and choose "Add to panel...".
- Select "Custom Application Launcher".
- Push the "Browse" button, find the 'run' script and select it.
- Click on the "No Icon" button and select the ImageJ icon (an antique brass microscope).
Troubleshooting
Here are some common problems encountered when running ImageJ on Linux, and their solutions:
- Cannot increase memory in Edit>Options>Memory & Threads or ImageJ unexpectedly runs out of memory.
Increase the memory limit by editing the 'run' script. A 64-bit version of Java is required to use more than 2GB of memory.
- Windows are blank or stacks are not displayed correctly on Ubuntu with compiz enabled.
Disable all effects in System Preferences > Appearance > Visual Effects.
Screenshot
This screenshot, created by pressing shift-g (Plugins>Utilities>Capture Screen), shows ImageJ running on a Linux netbook with a 800x480 screen, 512MB RAM and 4GB SSD.
![]()