可以。用JNI(Java Native Interface).
解决方案 »
- SSH两次查询同一记录…内存地址不一样…?
- 调试中出现source not found
- 研究了好久,还望高手赐教.....跪求!!!!!!!!!
- 请教finally语句
- 急求,请各位帮忙!
- coolroy2000(coolroy) 进来一下!
- 鼠标事件里面出发dialog的问题!!
- 急问表单提交中的空字符问题
- help!help!我的JDBC~~~~~~~~``
- 送分了!!!!!!!!!
- ***小弟想学J2EE了,有较好的网络编程,J2SE,RMI基础,想在寒假剩下的时间基本掌握它(40天左右),可能吗?望路人甲,两位斑竹和各位高手说说你们的经验
- 帮帮忙!!!请问在javascript中判断字符串中包含某一特定字符
class ShowMsgBox{
public static void main(String[] args) {
ShowMsgBox app = new ShowMsgBox();
app.ShowMessage("Generated with JNI");
}
private native void ShowMessage(String msg); //declare native method
static{
System.loadLibrary("MsgImpl");
}
}
之后:javac ShowMessage.java;javah -jni app1.ShowMessage(生成app1_ShowMsgBox.h)最后实现dll:#include <windows.h>
#include "app1_ShowMsgBox.h"BOOL APIENTRY DllMain(HANDLE hModule,
DWORD dwReason, void** lpReserved) {
return TRUE;
}
JNIEXPORT void JNICALL
Java_ShowMsgBox_ShowMessage(JNIEnv * jEnv,
jobject this, jstring jMsg) {
const char * msg;msg = (*jEnv)->GetStringUTFChars(jEnv, jMsg,0);MessageBox(HWND_DESKTOP, msg,"Thinking in Java: JNI",MB_OK |MB_ICONEXCLAMATION);(*jEnv)->ReleaseStringUTFChars(jEnv, jMsg,msg);
}(摘自thinking in java)