Here are full instructions on how I accomplished using the clrscr() C function in Java using JNI. I used the Borland C++ 5.02 compiler to make the DLL because VC++ does not provide a native clrscr() function in any of its include headers, so steps on building the DLL are BC++-specific. However, the compiled DLL, which you can download
here can be used as-is w/out recompiling.
[list]create NativeMethod.java with the following code:
Where "NativeMethod" is the name of the DLL compiled in later steps.[list]run javah on NativeMethod.java to create NativeMethod.h which should look like the following:
add #define __int64 long to NativeMethod.h above the #include <jni.h>[list]create NativeMethod.c to look like so:
compile the native dll with this command: bcc32 -tWDE -eNativeMethod.dll -Ic:\jdk1.3.1\include -Ic:\jdk1.3.1\include\win32 NativeMethod.c
note that your JDK path may be different than mine.[list] write a driver program to
test your new native call. mine is named Example.java and looks like this:
compile the java: c:\>javac NativeMethod.java Example.java run the app: c:\>java Example
If you want to skip the steps used to create the DLL, download the DLL I have created @ the URL above, create the two java files I listed and then go through the last two steps.
-Keith
[ May 29, 2002: Message edited by: Keith Owen ]
[ May 29, 2002: Message edited by: Keith Owen ]