Windows Installation

Installation

The Windows version of ImageJ is available bundled with 32-bit and 64-bit versions of Java, and without Java. The version bundled with 64-bit Java requires a 64-bit version of Windows. Both bundled versions include the javac compiler needed by the Plugins>Compile and Run command. All versions include ImageJ.exe, a Windows program contributed by George Silva that launches ImageJ (ij.jar).

ImageJ.exe supports file-associations, drag and drop, auto-configuration and command line operation. If the jre folder (the Java runtime) is missing, ImageJ.exe detects the latest installed Java, generates the configuration file (ImageJ.cfg) and sets the memory limit to 2/3 of installed memory or 640MB, whichever is lower. Refer to the ImageJ.exe README for more information.

Use the Help>Update Image command to upgrade to newer versions of ImageJ.

Memory

Use the Edit>Options>Memory command to make more than the default 640MB available to ImageJ. Note that setting the "Maximum Memory" value to more than about 75% of real RAM may result in poor perfomance due to virtual memory "thrashing". The Edit>Options>Memory command modifies the third line in the ImageJ.cfg file in the ImageJ folder, which must be writable. This is what ImageJ.cfg looks like with "Maximum Memory" set to 1500MB:
    .
    jre\bin\javaw.exe 
    -Xmx1500m -cp ij.jar ij.ImageJ
Note that this only works when you run ImageJ by double clicking on ImageJ.exe. No more than 64MB is available when you run ImageJ by double clicking on ij.jar.

You may get an error message that looks something like this:

    Unable to update the file "ImageJ.cfg
    C:\ Program Files\ImageJ\ImageJ.cfg (Access denied)
This error is the result of not have write access to the folder containing ImageJ. You need to either run ImageJ as an administrator, or to install it in a folder that you do have write access to, for example the Documents folder.

The maximum amount of memory that can be allocated on a 32-bit Windows system is ~1.5GB. Windows 64 with a 64-bit JVM does not have this limit.

64-bit Windows

To use more than ~1.5GB of memory requires a 64-bit CPU (AMD64, Intel Core 2 Duo, etc.), a 64-bit version of Windows, a 64-bit version of Java, and 3GB or more of RAM. A Windows version of ImageJ bundled with 64-bit Java is available on the Download page.

Use the Edit>Options>Memory & Threads command to allocate more than the default 640MB of memory. The title of the Memory & Threads dialog box changes to "Memory (64-bit)" when ImageJ is running on a 64-bit version of Java.

Troubleshooting

Here are some common problems encountered when running ImageJ on Windows, and their solutions:
  • ImageJ does not start.

    Delete the ImageJ.cfg file in the ImageJ folder.

  • Cannot increase memory in Edit>Options>Memory & Threads or ImageJ unexpectedly runs out of memory.

    Install ImageJ in a directory that you have write access to, such as "Documents" or "Desktop".

  • ImageJ displays blank windows or windows filled with garbage.

    Update video card driver or try running the nVidia Fix plugin

  • Multiple copies of ImageJ are started when I open images by double clicking on them or by dragging and dropping them on the ImageJ icon.

    Enable "Run single instance listener" in Edit>Options>Misc.

  • I installed a 64-bit version of Java but ImageJ is using the 32-bit version.

    Edit the second line of ImageJ.cfg to point to the 64-bit version of Java. For example, change "C:\Program Files (x86)\Java\jre7\bin" to "C:\Program Files\Java\jre7\bin".

  • Drag and Drop

    The Windows version of ImageJ opens images, folders of images, text files, ROIs and LUTs dropped on the "ImageJ" window or on the the ImageJ application icon.

    Compiling Plugins

    The Plugins>Compile and Run command uses the javac compiler contained in the tools.jar file included with Sun's Java Development Kit (JDK). Compile and Run works with versions of ImageJ bundled with Java because they includes a copy of the javac compiler in ImageJ/jre/lib/ext. It does not work if you use the version of ImageJ that is not bundled with Java and you have not installed the JDK. To fix this problem, uninstall the Java Runtime Environment (JRE), download and install the JDK, delete the Image\ImageJ.cfg file, and restart ImageJ. Compile and Run will not work if you launch ImageJ by double clicking on ij.jar.

    Command Line Options

    To run ImageJ from the command line, open a Command window, change to the ImageJ directory, and enter a command something like this:
    jre\bin\java -jar -Xmx1024m ij.jar
    
    The -Xmx1024m switch specifies that ImageJ will have available a maximum of 1024MB (1GB) of RAM.

    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
    
      -port
         Specifies 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
    

    Upgrading to a Newer Version of Java

    This is what you need to do to upgrade to a newer version of Java:

    Adding a JAR File

    Some plugins require a Java code library contained in a JAR file (e.g., Jama.jar). ImageJ's plugin class loader automatically loads code from such libraries as long as the JAR file is in the plugins folder or an immediate subfolder. The Plugins>Compile and Run command also supports JAR file libraries located in the plugins folder or a subfolder. Note that Compile and Run will not recognize the JAR file if the name does not end in ".jar" or if the name contains an underscore.

    About the Installer

    The ImageJ Windows installer is created using the Inno Setup installer generator.