FreeHEP Java Library

Components and Tools for Java

Building the FreeHEP Java Library

The FreeHEP libraries consist of 2 parts: The Java Libraries, and the Native Libraries. The latter are wrappers to, for instance, legacy Fortran code and to hook up the FreeHEP Java libraries to C++. In most cases one would only need to build the Java Libraries.

Building the Java libraries from the source code

To build the FreeHEP Java libraries you have to use ANT, which comes as part of the checked out CVS tree. The build of FreeHEP was tested on WindowsXP/2000/NT, Linux and Solaris, using the Java Development Kit 1.4 or later.

Execute the following 5 steps:

  1. Set the environment variable JDK_HOME to the root of your java development kit (1.4 or later).
  2. Add JDK_HOME/bin to your PATH. This is needed to find commands such as "idlj".
  3. Set the environment variable FREEHEP to the root of the FreeHEP distribution.
  4. Change directory to the root of the freehep distribution.
  5. Execute ant to build the default target (all separate freehep jar files which end up in the lib directory).
Step Unix (Linux/Solaris) example Windows (2000/NT) example
1
setenv JDK_HOME /usr/local/jdk-1.4.0
set JDK_HOME=D:\jdk-1.4.0
2
setenv PATH /bin:
set PATH=%JDK_HOME%\bin;%PATH%
3
setenv FREEHEP /home/duns/freehep
set FREEHEP=D:\home\duns\freehep
4
cd /home/duns/freehep
cd D:\home\duns\freehep
5
tools/ant
tools\ant

Other suggestions and commands

You may want to add FREEHEP/tools to your PATH, and try also the following commands:

Command Description
ant help
shows usage of ANT for FreeHEP
ant -projecthelp
lists all available targets
ant -Djar=base
builds only the jar file with name "freehep-base"

Building the Native libraries from the source code

To build the FreeHEP Native libraries you have to use gmake, which comes for Windows as part of the checked out CVS tree and is normally part of  Unix/MacOSX (use make) systems.

You further need a C/C++ compiler and if you want to link with CERNLIB the Fortran compile-time libraries. 

We assume you have already set up your environment for compiling the Java libraries.

Now execute the following 4 steps:

  1. Set the environment variable OS to the OS you are running on.
  2. Set the environment variable CERN_ROOT to the root of the CERN LIBRARY distribution.
  3. Change directory to the root of the freehep distribution
  4. Execute gmake to build the default target; the libs will end up in the lib/OSTYPE-COMPILER directory.
Step Unix (Linux/Solaris/MacOS X) example Windows (XP/2000/NT) example
1
setenv OS Linux | Solaris | Darwin
normally already set to Windows...
2
normally already set to /cern/pro
set CERN_ROOT=D:\cern\pro
3
cd /home/duns/freehep
cd D:\home\duns\freehep
4
gmake
make (on MacOS X)
gmake

Steps 2 may be omitted, in which case parts of the FreeHEP native libraries will not be compiled.