FARSIGHT Tutorials/Building Software/Installing JDK

From FarsightWiki
Jump to: navigation, search

Contents

Overview

Java is necessary for Bio-Formats to interface with FARSIGHT. At runtime, only the JRE is necessary to execute the Bio-Formats code. However, at compile time, the full J2SE development kit (JDK) is required for two reasons. First, the Jace proxy class generator is written in Java, so Ant needs a working Java compiler to compile Jace itself. Second, on Windows, only the JDK comes bundled with the JVM shared library (jvm.lib) necessary to link with Java.


Installing the JDK on Mac OS X

Mac OS X comes with Java; you do not need to install anything. :-)


Installing the JDK on Linux

To install the JDK on Debian-based Linux, execute:

sudo apt-get install sun-java6-jdk
sudo update-alternatives --config java

Then select Sun's Java implementation as the system default.

It may be possible to use a different Java compiler (i.e., omit the sun-java6-jdk package and update-alternatives step), but we have only tested the compilation process with Sun's Java compiler.

Other distributions of Linux may have a similar Java package available through their respective package managers as well.


Installing the JDK on Windows

Download the JDK from

Choose "Java SE" from the right-hand menu, and download the latest Java SE Development Kit (JDK). Run the installer.

After installing Sun's JDK, create a new environment variable called JAVA_HOME pointing to your Java installation; e.g.:

C:\Program Files\Java\jdk1.6.0_13

Setting JAVA_HOME is the easiest way to ensure that Ant can locate Java.

You will also need to append your JDK's client or server VM folder to the PATH; e.g.:

%JAVA_HOME%\jre\bin\client

This step ensures that a directory containing jvm.dll is present in the PATH. If you do not perform this step, you will receive a runtime error when attempting to initialize a JVM from native code.

Optionally, you can add the bin subdirectory to the PATH; e.g.:

%JAVA_HOME%\bin

Once set, new Command Prompts will recognize (e.g.) "javac" as a valid command.

Personal tools