build.bat
|
@rem
Build the jni22 example on Windows
@rem create the build/classes directory
mkdir build
mkdir build\classes
@rem Compile the Java
javac -classpath build/classes -d build/classes src/javatech/jni22/*.java
@rem Run javah to generate the header file
javah -classpath build/classes -d build/headers -jni javatech.jni22.JNIHelloWorld
javah -classpath build/classes -d build/headers -jni javatech.jni22.StringExample
javah -classpath build/classes -d build/headers -jni javatech.jni22.ArrayExample
javah -classpath build/classes -d build/headers -jni javatech.jni22.JNIDemo
@rem Compile the C++ native implementation codes. This requires
Microsoft
@rem Visual C++ 6.0.
mkdir build\objs
cl -c -Ibuild\headers -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32
-Fobuild\objs\NativeHelloWorld.obj src\javatech\jni22\NativeHelloWorld.cpp
cl -c -Ibuild\headers -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32
-Fobuild\objs\NativeString.obj src\javatech\jni22\NativeString.cpp
cl -c -Ibuild\headers -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32
-Fobuild\objs\NativeArray.obj src\javatech\jni22\NativeArray.cpp
cl -c -Ibuild\headers -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32
-Fobuild\objs\NativeJNIDemo.obj src\javatech\jni22\NativeJNIDemo.cpp
@rem Create the shared library DLLs
link -dll build\objs\NativeHelloWorld.obj -out:build\NativeHelloWorld.dll
link -dll build\objs\NativeString.obj -out:build\NativeString.dll
link -dll build\objs\NativeArray.obj -out:build\NativeArray.dll
link -dll build\objs\NativeJNIDemo.obj -out:build\NativeJNIDemo.dll
|
clean.bat
|
@rem clean up all generated and
compiled files for the javatech-22 directory
rmdir/s/q build |
run.demo.bat
|
@rem Run the jni22 JNIDemo example
on Windows
java -classpath build/classes -Djava.library.path=build javatech.jni22.JNIDemo
|
run.hello.bat
|
@rem
Run the jni22 example on Windows
java -classpath build/classes -Djava.library.path=build
javatech.jni22.JNIHelloWorld
@rem alternatively, we can add to PATH to include the location
of the shared
@rem library, NativeHelloWorld.dll, that must be found at
runtime.
@rem set PATH=build;%PATH%
@rem java -classpath build/classes javatech.jni22.JNIHelloWorld
|
run.string.bat
|
@rem Run the jni22 StringExample
on Windows
java -classpath build/classes -Djava.library.path=build javatech.jni22.StringExample |
run.array.bat
|
@rem Run the jni22 ArrayExample
on Windows
java -classpath build/classes -Djava.library.path=build javatech.jni22.ArrayExample |