解决方案 »

  1.   

    Compilation events (10 events): 
    Event: 0.097 Thread 0x0000000014e7c000   16  s    3       java.lang.StringBuffer::append (13 bytes) 
    Event: 0.097 Thread 0x0000000014e7c000 nmethod 16 0x00000000029fef10 code [0x00000000029ff0a0, 0x00000000029ff508] 
    Event: 0.097 Thread 0x0000000014e7c000   14       3       java.util.Arrays::copyOfRange (63 bytes) 
    Event: 0.098 Thread 0x0000000014e7c000 nmethod 14 0x00000000029fdd50 code [0x00000000029fdf60, 0x00000000029fea18] 
    Event: 0.098 Thread 0x0000000014e7c000   18       3       java.lang.Math::min (11 bytes) 
    Event: 0.098 Thread 0x0000000014e7c000 nmethod 18 0x00000000029fda10 code [0x00000000029fdb60, 0x00000000029fdcf0] 
    Event: 0.098 Thread 0x0000000014e7c000   17       3       java.lang.String::<init> (62 bytes) 
    Event: 0.098 Thread 0x0000000014e7c000 nmethod 17 0x00000000029fd210 code [0x00000000029fd3c0, 0x00000000029fd7d8] 
    Event: 0.102 Thread 0x0000000014e7c000   19       1       java.lang.Object::<init> (1 bytes) 
    Event: 0.102 Thread 0x0000000014e7c000 nmethod 19 0x00000000029fc510 code [0x00000000029fc660, 0x00000000029fc770] GC Heap History (2 events): 
    Event: 0.073 GC heap before 
    {Heap before GC invocations=1 (full 0): 
    PSYoungGen      total 1024K, used 505K [0x00000000eb800000, 0x00000000eb980000, 0x0000000100000000) 
      eden space 512K, 98% used [0x00000000eb800000,0x00000000eb87e6d8,0x00000000eb880000) 
      from space 512K, 0% used [0x00000000eb900000,0x00000000eb900000,0x00000000eb980000) 
      to   space 512K, 0% used [0x00000000eb880000,0x00000000eb880000,0x00000000eb900000) 
    ParOldGen       total 61952K, used 0K [0x00000000c2800000, 0x00000000c6480000, 0x00000000eb800000) 
      object space 61952K, 0% used [0x00000000c2800000,0x00000000c2800000,0x00000000c6480000) 
    Metaspace       used 1857K, capacity 4480K, committed 4480K, reserved 1056768K 
      class space    used 206K, capacity 384K, committed 384K, reserved 1048576K 
    Event: 0.073 GC heap after 
    Heap after GC invocations=1 (full 0): 
    PSYoungGen      total 1024K, used 488K [0x00000000eb800000, 0x00000000eba00000, 0x0000000100000000) 
      eden space 512K, 0% used [0x00000000eb800000,0x00000000eb800000,0x00000000eb880000) 
      from space 512K, 95% used [0x00000000eb880000,0x00000000eb8fa020,0x00000000eb900000) 
      to   space 512K, 0% used [0x00000000eb980000,0x00000000eb980000,0x00000000eba00000) 
    ParOldGen       total 61952K, used 0K [0x00000000c2800000, 0x00000000c6480000, 0x00000000eb800000) 
      object space 61952K, 0% used [0x00000000c2800000,0x00000000c2800000,0x00000000c6480000) 
    Metaspace       used 1857K, capacity 4480K, committed 4480K, reserved 1056768K 
      class space    used 206K, capacity 384K, committed 384K, reserved 1048576K 
    } Deoptimization events (0 events): 
    No events Internal exceptions (3 events): 
    Event: 0.034 Thread 0x00000000027f2800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x00000000eb814b90) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u5\2488\hotspot\src�����? 
    Event: 0.034 Thread 0x00000000027f2800 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x00000000eb814e20) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u5\2488\hotspot\src\share\vm\prims\jn�PH��? 
    Event: 0.097 Thread 0x00000000027f2800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000eb82a7f8) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u5\2488\hotspot\src\share\vm\prims\jvm.cpp, line 1248] Events (10 events): 
    Event: 0.101 loading class java/security/AllPermission 
    Event: 0.101 loading class java/security/AllPermission done 
    Event: 0.101 loading class java/security/UnresolvedPermission 
    Event: 0.101 loading class java/security/UnresolvedPermission done 
    Event: 0.101 loading class java/security/BasicPermissionCollection 
    Event: 0.101 loading class java/security/BasicPermissionCollection done 
    Event: 0.102 loading class sun/launcher/LauncherHelper$FXHelper 
    Event: 0.102 loading class sun/launcher/LauncherHelper$FXHelper done 
    Event: 0.102 loading class java/lang/ClassLoaderHelper 
    Event: 0.102 loading class java/lang/ClassLoaderHelper done 
    Dynamic libraries: 
    0x000007f66bd70000 - 0x000007f66bda4000 D:\Java\jdk1.8.0_05\bin\javaw.exe 
    0x000007fa57130000 - 0x000007fa572f0000 C:\windows\SYSTEM32\ntdll.dll 
    0x000007fa56fa0000 - 0x000007fa570d6000 C:\windows\system32\KERNEL32.DLL 
    0x000007fa53ff0000 - 0x000007fa540e3000 C:\windows\system32\KERNELBASE.dll 
    0x000007fa54240000 - 0x000007fa5431e000 C:\windows\system32\ADVAPI32.dll 
    0x000007fa55030000 - 0x000007fa5517c000 C:\windows\system32\USER32.dll 
    0x000007fa51c00000 - 0x000007fa51e6a000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9200.16579_none_418ab7ef718b27ef\COMCTL32.dll 
    0x000007fa54500000 - 0x000007fa545a5000 C:\windows\system32\msvcrt.dll 
    0x000007fa54c70000 - 0x000007fa54cb8000 C:\windows\SYSTEM32\sechost.dll 
    0x000007fa56460000 - 0x000007fa565a5000 C:\windows\system32\RPCRT4.dll 
    0x000007fa54a50000 - 0x000007fa54b91000 C:\windows\system32\GDI32.dll 
    0x000007fa54720000 - 0x000007fa54759000 C:\windows\system32\IMM32.DLL 
    0x000007fa56640000 - 0x000007fa56756000 C:\windows\system32\MSCTF.dll 
    0x0000000058100000 - 0x00000000581d2000 D:\Java\jdk1.8.0_05\jre\bin\msvcr100.dll 
    0x00000000578d0000 - 0x00000000580fa000 D:\Java\jdk1.8.0_05\jre\bin\server\jvm.dll 
    0x000007fa4b190000 - 0x000007fa4b199000 C:\windows\SYSTEM32\WSOCK32.dll 
    0x000007fa540f0000 - 0x000007fa54110000 C:\windows\system32\WINMM.dll 
    0x000007fa56800000 - 0x000007fa56807000 C:\windows\system32\PSAPI.DLL 
    0x000007fa54320000 - 0x000007fa54378000 C:\windows\system32\WS2_32.dll 
    0x000007fa53cf0000 - 0x000007fa53d23000 C:\windows\system32\WINMMBASE.dll 
    0x000007fa54610000 - 0x000007fa54619000 C:\windows\system32\NSI.dll 
    0x000007fa53f40000 - 0x000007fa53f8f000 C:\windows\SYSTEM32\cfgmgr32.dll 
    0x000007fa54210000 - 0x000007fa54232000 C:\windows\system32\DEVOBJ.dll 
    0x00000000578c0000 - 0x00000000578cf000 D:\Java\jdk1.8.0_05\jre\bin\verify.dll 
    0x0000000057890000 - 0x00000000578b8000 D:\Java\jdk1.8.0_05\jre\bin\java.dll 
    0x0000000057870000 - 0x0000000057886000 D:\Java\jdk1.8.0_05\jre\bin\zip.dll 
    0x000007fa55180000 - 0x000007fa5645f000 C:\windows\system32\SHELL32.dll 
    0x000007fa56df0000 - 0x000007fa56fa0000 C:\windows\SYSTEM32\combase.dll 
    0x000007fa570e0000 - 0x000007fa57130000 C:\windows\system32\SHLWAPI.dll 
    0x000007fa52080000 - 0x000007fa52115000 C:\windows\SYSTEM32\SHCORE.dll 
    0x000007fa53c40000 - 0x000007fa53c55000 C:\windows\SYSTEM32\profapi.dll 
    0x0000000069080000 - 0x000000006919a000 D:\workspace\myClient\resource\libmyServer.dll
    0x000000006fc40000 - 0x000000006fd2b000 C:\Program Files (x86)\mingw64\bin\libstdc++-6.dll 
    0x0000000061440000 - 0x0000000061460000 C:\Program Files (x86)\mingw64\bin\libgcc_s_seh-1.dll 
    0x000000006a140000 - 0x000000006a18c000 D:\workspace\myServer\resource\libdrive.dll 
    0x000007fa38cd0000 - 0x000007fa38e33000 C:\windows\SYSTEM32\dbghelp.dll VM Arguments: 
    jvm_args: -Djava.library.path=D:\workspace/myClient/resource;d:\app\bing\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Condusiv Technologies\ExpressCache\;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Java\jdk1.8.0_05\bin;;C:\ORACLE\instantclient_11_2;D:\maven\bin;C:\Program Files (x86)\mingw64\bin; -Dfile.encoding=UTF-8 
    java_command: myClient.OpenCloseDrive 
    java_class_path (initial): D:\workspace\myClient\bin 
    Launcher Type: SUN_STANDARD Environment Variables: 
    JAVA_HOME=D:\Java\jdk1.8.0_05 
    PATH=d:\app\bing\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Condusiv Technologies\ExpressCache\;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Java\jdk1.8.0_05\bin;;C:\ORACLE\instantclient_11_2;D:\maven\bin;C:\Program Files (x86)\mingw64\bin; 
    USERNAME=bing 
    OS=Windows_NT 
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel ---------------  S Y S T E M  --------------- OS: Windows 8 , 64 bit Build 9200 CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, erms, ht, tsc, tscinvbit Memory: 4k page, physical 4024012k(427032k free), swap 8087244k(3955068k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (25.5-b02) for windows-amd64 JRE (1.8.0_05-b13), built on Mar 18 2014 01:08:39 by "java_re" with MS VC++ 10.0 (VS2010) time: Mon Aug 04 20:02:38 2014 
    elapsed time: 0 seconds 
      

  2.   


    见上面红框处,打开注释就报错误,
    为什么FEncodeString fe = (FEncodeString)GetProcAddress(dllhandle, "sysHello"); 这句代码fe返回的是0呢?
    我那写错了吗?
      

  3.   

    JNI 代码:#include <iostream>
    #include <windows.h>
    #include "myClient_OpenCloseDrive.h"
    using namespace std;
    typedef void (_stdcall *FEncodeString)();JNIEXPORT void JNICALL Java_myClient_OpenCloseDrive_openCloseAllDrive
      (JNIEnv *env, jobject, jboolean)
    {
    HINSTANCE dllhandle = LoadLibrary("D:\\workspace\\myServer\\resource\\libdrive.dll");    if (dllhandle != NULL)
        {
        FEncodeString fe = (FEncodeString)GetProcAddress(dllhandle, "sysHello");    fe();
        }
    FreeLibrary(dllhandle);  //   cout << "Hello" << dllhandle<< "Hello" << fe << endl;
    }libdrive.dll代码:#include <iostream>
    using namespace std;void sayHello()
    {
    cout << "!!!Hello World!!!" << endl;
    }