Java中怎么调用Windows的API 1.建TestAPI.java public class TestAPI { public static void testshow(String msg) { testshow0(msg); } private static native int testshow0(String msg); static { System.loadLibrary( TestAPI ); } public static void ma
Java中怎么调用Windows的API
1.建TestAPI.java
public class TestAPI
{
public static void testshow(String msg)
{
testshow0(msg);
}
private static native int testshow0(String msg);
static
{
System.loadLibrary( "TestAPI" );
}
public static void main( String[] args )
{
testshow("Hello!");
}
}
2.javac TestAPI.java
3.javah -jni TestAPI
4.建TestAPI.c
#include
#include "TestAPI.h"
JNIEXPORT jint JNICALL Java_TestAPI_te