Compiling HDF-JAVA Source on Windows

Source Files

After you download and extract the source package, you will have the HDF Java native C code and the Java source code for JNI, HDF-Object package and HDFView. You need to compile the C source and Java source separately. The following instructions tell you how to build the C source in Visual C++ and the Java source from batch file.

HDF Java Product Source
Source directory Description
hdf-java/native/hdflib/ C header files and C source files for HDF4 Java Native Interface
hdf-java/native/hdf5lib/ C header files and C source files for HDF5 Java Native Interface
hdf-java/ncsa/hdf/hdflib/ Java source files for HDF4 Java Native Interface
hdf-java/ncsa/hdf/hdf5lib/ Java source files for HDF5 Java Native Interface
hdf-java/ncsa/hdf/object/ Java source files for HDF-Object package
hdf-java/ncsa/hdf/view/ Java source files for HDFView


Requirements

You need the following libraries in order to compile the HDF Java products.

Compile the HDF Java Native C

To compile the HDF Java Native C code, you need to have Microsoft Visual Studio 2008 installed on your machine. Under the windows\proj\all folder is the solution file.
jhdf.vcproj
Project to compile HDF4 Java Native C, native/hdflib/*.c files
Winsock functions, Ws2_32.lib, must be included, i.e. LINK32_FLAGS=... ws2_32.lib ...
jhdf5.vcproj
Project to compile HDF5 Java Native C, native/hdf5lib/*.c files
To use the batch files the JAVAHOME environment variable must be set. Using the VS2008 command line, change into the hdf-java\windows folder and run copy_hdf.bat.

Compile the HDF native Source Code

To compile the HDF native Source Code, you run the jnibuild.bat batch file within the hdf-java root folder. You must pass the compiler version (currently only VS9) as a parameter.
jnibuild.bat
Batch to compile HDF native source

Compile the HDF Java Source Code

To compile the HDF Java Source Code, you need to have jdk1.5.0 or above installed on your machine. You run the javabuild.bat batch file within the hdf-java root folder. You must pass the hdf-java source folder (C:\hdf-java) as a parameter.
javabuild.bat
Batch to compile HDF Java source

Test the HDF Java Build

To test the HDF Java Build, you need to have jdk1.5.0 or above installed on your machine. You run the javacheck.bat batch file within the hdf-java root folder. You must pass the hdf-java source folder (C:\hdf-java) as a parameter.
javacheck.bat
Batch to test HDF Java

Install the HDF Java Build

To install the HDF Java Build, you need to have jdk1.5.0 or above installed on your machine. You run the javainstall.bat batch file within the hdf-java root folder. You must pass the destination folder (C:\programs\hdf-java) as a parameter.
javainstall.bat
Batch to install HDF Java

Running the HDF Java code

After successfully run the batch files, the binaries of the HDF Java products are packed and put at destination folder.

Binary file Description
lib/jhdf.jar The Java HDF Interface, accesses the native HDF4 library
lib/jhdf5.jar The Java HDF5 Interface, accesses the native HDF5 library
lib/jhdfobj.jar The common HDF object package, ncsa.hdf.object
lib/jhdf4obj.jar The HDF4 object package, ncsa.hdf.object.h4
lib/jhdf5obj.jar The HDF5 object package, ncsa.hdf.object.h5
lib/jhdfview.jar The ncsa.hdf.view package, for HDFView only.
  lib/win/
      jhdf.dll The native HDF4 library and JNI implementation (called by jhdf.jar)
      jhdf5.dll The native HDF5 library and JNI implementation (called by jhdf5.jar)