Changes between Version 5 and Version 6 of GdalOgrInJavaBuildInstructionsUnix
- Timestamp:
- Oct 6, 2009, 3:28:54 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GdalOgrInJavaBuildInstructionsUnix
v5 v6 1 = Building GDAL/OGR Java Bindings on Linux/Unix =1 = Building GDAL/OGR Java Bindings on Linux/Unix/MinGW = 2 2 3 Tested with gdal-1.5.2 .3 Tested with gdal-1.5.2 and GDAL 1.7.0 4 4 5 5 == Configure and Build GDAL == 6 7 You need swig in the path. 6 8 7 9 I found I had to configure GDAL --without-libtool to get the java bindings to build. … … 11 13 == Update java.opt == 12 14 13 Replace/Create gdal/swig/java/java.opt with an appropriate local version. Make sure the windows backslashes are turned to forward slashes, and point to your local Java SDK. The ANT_HOME isn't used on linux where it is apparently assumed ant willbe in the path.15 Replace/Create gdal/swig/java/java.opt with an appropriate local version. Make sure the windows backslashes are turned to forward slashes, and point to your local Java SDK. ant is assumed to be in the path. 14 16 15 17 {{{ 16 18 JAVA_HOME = /home/warmerda/pkg/jdk1.6.0_10 17 #ANT_HOME=c:\programmi\apache-ant-1.7.018 19 JAVADOC=$(JAVA_HOME)/bin/javadoc 19 20 JAVAC=$(JAVA_HOME)/bin/javac … … 26 27 27 28 See this ticket http://trac.osgeo.org/gdal/ticket/2401 for a patch and java.opt for building the java bindings on Leopard 29 30 === Win32 MinGW === 31 32 Tested with GDAL 1.7.0. Building the Java bindings under MinGW is possible but requires a bit of patching : 33 34 * Update the JAVA_HOME variable in gdal/swig/java/java.opt and change the JAVA_INCLUDE variable to the following value : 35 {{{ 36 JAVA_INCLUDE=-I$(JAVA_HOME)/include -I. 37 }}} 38 39 * in swig/java/GNUmakefile, we ensure that the name of the DLLs are not prefixed by lib, by changing the 'JAVA_MODULES= libgdaljni.$(SO_EXT)...' and '$(JAVA_MODULES): %jni.$(SO_EXT)...' lines to be 40 41 {{{ 42 JAVA_MODULES = gdaljni.$(SO_EXT) ogrjni.$(SO_EXT) gdalconstjni.$(SO_EXT) osrjni.$(SO_EXT) 43 }}} 44 45 and 46 47 {{{ 48 $(JAVA_MODULES): %jni.$(SO_EXT): %_wrap.$(OBJ_EXT) 49 }}} 50 51 * Create a jni_md.h file in gdal/swig/java directory with the following content that ensures thanks to the empty JNICALL that the symbols in the *jni.dll have the proper decorations 52 53 {{{ 54 #ifndef _GDAL_JNI_MD_H_ 55 #define _GDAL_JNI_MD_H_ 56 57 #define JNIEXPORT __declspec(dllexport) 58 #define JNIIMPORT __declspec(dllimport) 59 #define JNICALL 60 61 typedef long jint; 62 typedef __int64 jlong; 63 typedef signed char jbyte; 64 65 #endif 66 }}} 67 68 Then run make from gdal/swig/java. and the GDAL DLL is in the path, "java -cp "gdal.jar;build/apps" gdalinfo" should work. 28 69 29 70 == Run the java build == … … 63 104 }}} 64 105 106 Starting with GDAL 1.7.0, the utilities are automatically built in the swig/java/build/apps directory. So after building, you can just do 107 108 {{{ 109 setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:`pwd` 110 java -classpath `pwd`/gdal.jar:`pwd`:`pwd`/build/apps gdalinfo 111 }}} 112 65 113 With luck you will see the gdalinfo usage message. 66 114