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.
| 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.- The Pre-Compiled HDF4 Binaries: obtain from /release4/obtain.html
- The Pre-Compiled HDF5 Binaries: obtain from /HDF5/release/obtain5.html
- JPEG Library: obtain from ftp://ftp.hdfgroup.org/lib-external/jpeg/
- GZIP Library: obtain from ftp://ftp.hdfgroup.org/lib-external/zlib/
- SZIP Library: obtain from ftp://ftp.hdfgroup.org/lib-external/szip/
- JDK 1.5.0 or above
Compile the HDF Java Native C
To compile the HDF Java Native C code, you need to have Microsoft Visual C++ installed on your machine. Two Windows Makefiles hdf-java/windows are provided to help you to build the C source code.- jhdf.mak
- Makefile 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.mak
- Makefile to compile HDF5 Java Native C, native/hdf5lib/*.c files
|
#============================================================================ # # Makefile to compile HDF Java Native C Source # Usage: nmake /f jhdf.mak # #============================================================================ # Visual C++ directory, for example #VCPPDIR=C:\Program Files\Microsoft Visual Studio\VC98 VCPPDIR= # directory where JDK is installed (need JDK1.5.0 or above), for example #JAVADIR=D:\java\jDK1.5.0\ JAVADIR= # directory of the HDF Java Products, for example #HDFJAVADIR=D:\work\hdf-java\ HDFJAVADIR= # the directory where HDF library is installed, for example #HDFDIR=E:\Work\MyHDFstuff\hdf-42r0\ HDFDIR= # the JPEG library, for example #JPEGLIB=E:\Work\MyHDFstuff\lib-external\jpeg\libjpeg.lib JPEGLIB= # the GZIP library, for example #GZIPLIB=E:\Work\MyHDFstuff\lib-external\zlib\bin\windows\zlib114\lib\zlib.lib GZIPLIB= # SZIP library, for example #SZIPLIB=E:\Work\MyHDFstuff\lib-external\szip\bin\windows\szip-msvc++\lib\szlib.lib SZIPLIB= |
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. A batch file under hdf-java/windows is provided to help you to build the Java source code.- Makefile_java.bat
- Batch to compile HDF Java source
|
@ECHO OFF @REM ======================================================================= @REM @REM Batch file to compile the HDF Java source code @REM @REM ======================================================================= @REM set up your java home directory(requires jdk1.5.0 or above), for example @REM SET JAVAHOME=d:\java\jdk1.5.0 SET JAVAHOME= @REM set up "HDF JAVA Product" home directory, for example @REM SET HDFJAVA=D:\work\hdf-java SET HDFJAVA= |
Running the HDF Java code
After successfully run the makefile and batch file, the binaries of the HDF Java products are packed and put at $(JAVAHOME)\lib.
| 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) | |
Set the following batch file to run the HDFView
@ECHO OFF
@REM =======================================================================
@REM
@REM Batch file to run the HDFView
@REM
@REM =======================================================================
@REM set up your java home directory(requires jdk1.5.0 or above), for example
@REM SET JAVAHOME=d:\java\jdk1.5.0
SET JAVAHOME=
@REM set up "HDF JAVA Product" home directory, for example
@REM SET HDFJAVA=D:\work\hdf-java
SET HDFJAVA=
@REM Do not make changes under this line unless you know what you are doing.
@REM =======================================================================
SET PATH=%HDFJAVA%\lib\win;%PATH%
@REM set the JNI classpath
set JNI_CLASSPATH=%HDFJAVA%/lib/jhdf.jar;%HDFJAVA%/lib/jhdf5.jar
@REM set the object package classpath
set OBJ_CLASSPATH=%HDFJAVA%/lib/jhdfobj.jar;%HDFJAVA%/lib/jhdf4obj.jar;
(continued)%HDFJAVA%/lib/jhdf5obj.jar;%HDFJAVA%\lib\netcdf.jar;%HDFJAVA%\lib\fits.jar
@REM set the CLASSPATH
set CLASSPATH=%JNI_CLASSPATH%;%OBJ_CLASSPATH%;%HDFJAVA%/lib/jhdfview.jar
%JAVAHOME%\bin\java -mx999m -classpath %CLASSPATH% ncsa.hdf.view.HDFView -root %HDFJAVA%
pause
:END
- - Last modified:October 19th 2007
