Repository navigation
Expand file tree
/
Copy pathTestHDF5Link.java
More file actions
73 lines (64 loc) · 2.44 KB
/
Copy pathTestHDF5Link.java
File metadata and controls
73 lines (64 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/****************************************************************************
* NCSA HDF *
* National Comptational Science Alliance *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* *
* For conditions of distribution and use, see the accompanying *
* java-hdf5/COPYING file. *
* *
****************************************************************************/
/*
* This program tests the linking and calling of the HDF-5 library.
*
* The purpose is to help debug the installation of the JHI-5.
*/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class TestHDF5Link {
static public void main( String []args )
{
String libPath = System.getProperty("java.library.path",null);
if ( libPath == null ) {
System.out.println("ERROR: No library path set.");
System.exit(1);
}
System.out.println("Searching for libraries in: "+libPath);
System.out.flush();
System.out.println("Test load of Java HDF-5 Interface: ");
try {
System.loadLibrary("jhdf5");
} catch (Throwable t1) {
System.out.println("Exception loading Java HDF-5 Interface: "+t1);
System.exit(1);
}
System.out.println("OK. (libjhdf5.so)");System.out.flush();
int status = -1;
System.out.println("\nTest call to HDF-5 Library:");
try {
status = H5.H5open();
status = H5.H5close();
} catch (Throwable t3) {
System.out.println("Exception calling HDF-5 Library: "+t3);
System.exit(1);
}
System.out.println("OK. (H5.H5open())");System.out.flush();
System.out.println("\n");System.out.flush();
System.out.println("Path is Correct: \n\t"+libPath);
status = -1;
int fid = -1;
System.out.println("\nTest call to create file:");
try {
status = H5.H5open();
fid = H5.H5Fcreate("test.h5",0,0,0);
status = H5.H5Fclose(fid);
status = H5.H5close();
} catch (Throwable t3) {
System.out.println("Exception creating HDF-5 file: "+t3);
System.exit(1);
}
System.out.println("OK. (H5.H5Fcreate())");System.out.flush();
System.out.println("\n");System.out.flush();
System.out.println("Library works");
}
}