System.load()永远不会发生

System.load() never happens

本文关键字:永远 load System      更新时间:2023-10-16

我在一个自签名Java applet上使用System.load(),旧版本的dll加载良好,但我的新版本(即使dll构建良好)不加载,不抛出任何异常,只是停止代码在它的轨道。

你知道是什么原因导致的吗?

这是部署jar文件的html:

<embed  id = "IB" 
type = "application/x-java-applet" 
width = "{$width}" 
height = "{$height}" 
code = "{$code}"
archive = "{$archive}"
username = "{$username}"
password = "{$password}"
account = "{$customer_ref}"
debug = "{$debug}"
baseweburl = "{$baseweburl}"
webserviceurl = "{$webserviceurl}"
/>

我用来创建Dll文件的c++代码:

标头(javah created)

/*
 * Class:     i_jni_B
 * Method:    DeviceOnline
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_i_jni_B_DeviceOnline
  (JNIEnv *, jobject);

Cpp文件

JNIEXPORT jboolean JNICALL Java_i_jni_B_DeviceOnline
  (JNIEnv *env, jobject)
{
    try
    {
        CDevice* clsDevice = new CDevice();
        clsDevice->Initialize();
        clsDevice->Release();
        return true;
    }
    catch (System::Exception^ ex)
    {
        return false;
    }
}

你永远不会相信这个解决方案:我在调试模式下使用了Visual Studio。当设置为释放模式时,一切功能完美!