title: JNI exception access violation
body: <p>at the moment i´m trying to play around with JNI.</p>
  
  <p>My Java-Code :</p>
  
  <pre><code>public class test{
  static{
  
      System.loadLibrary("wakeup64");
  
  }
  
  public static native boolean setWakeupTime(Date date);
  
  public static void set(){
      Date d = new Date();
      setWakeupTime(d);
  
  }
  
  }
  </code></pre>
  
  <p>C-Code:</p>
  
  <pre><code>#include &lt;jni.h&gt;
  #include "cpp_interface.h"
  #include &lt;stdio.h&gt;
  
  JNIEXPORT void JNICALL Java_test_setWakeupTime
    (JNIEnv *env, jclass cl, jobject date){
  
      printf("test");
  
    }
  
    int main(){
  
    }
  </code></pre>
  
  <p>The code compiles fine but if I run my java Class i´m getting an exception_access_violation:</p>
  
  <pre><code>#
  # A fatal error has been detected by the Java Runtime Environment:
  #
  #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000000000c038, pid=7456, tid=4640
  #
  # JRE version: 7.0_03-b05
  # Java VM: Java HotSpot(TM) 64-Bit Server VM (22.1-b02 mixed mode windows-amd64     compressed oops)
  # Problematic frame:
  # C  0x000000000000c038
  #
  # Failed to write core dump. Minidumps are not enabled by default on client versions of     Windows
  #
  # If you would like to submit a bug report, please visit:
  #   http://bugreport.sun.com/bugreport/crash.jsp
  # The crash happened outside the Java Virtual Machine in native code.
  # See problematic frame for where to report the bug.
  #
  
  ---------------  T H R E A D  ---------------
  
  Current thread (0x000000000211b000):  JavaThread "main" [_thread_in_native, id=4640,     stack(0x0000000002290000,0x0000000002390000)]
  
  siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008 0x000000000000c038
  
  Registers:
  RAX=0x0000000000000000, RBX=0x0000000000000015, RCX=0x00000000fffffff4,     RDX=0x000000014000d040
  RSP=0x000000000238f668, RBP=0x000000000238f858, RSI=0x0000000000000001, RDI=0x00000000000000fc
  R8 =0x000000000238f878, R9 =0x00000000065cc490, R10=0x00000000023a21bc, R11=0x000000005b958940
  R12=0x0000000000000000, R13=0x000000073b0739e0, R14=0x000000014000d570, R15=0x000000000211b000
  RIP=0x000000000000c038, EFLAGS=0x0000000000010246
  
  Top of Stack: (sp=0x000000000238f668)
  0x000000000238f668:   0000000140002cd9 000000000238f7c0
  0x000000000238f678:   000000005b922181 000000000211bd88
  0x000000000238f688:   000000000211b000 0000000000000003
  0x000000000238f698:   000000000211ba90 000000000238f878
  0x000000000238f6a8:   0000000140002d60 0000000000000011
  0x000000000238f6b8:   000000000211b000 000000014000d750
  0x000000000238f6c8:   000000073b0739e0 000000000211b990
  0x000000000238f6d8:   0000000140004374 000000000211bd88
  0x000000000238f6e8:   0000000000000004 000000000238f7c0
  0x000000000238f6f8:   00000000023ad623 000000073b0739e0
  0x000000000238f708:   0000000140004453 0000000000000022
  0x000000000238f718:   000000073b073730 000000014000d750
  0x000000000238f728:   000000000211b000 000000000238f7c8
  0x000000000238f738:   00000001400015e2 000000014000d040
  0x000000000238f748:   0000000140001000 000000000238f858
  0x000000000238f758:   0000000000000000 000000073b0739e0 
  
  Instructions: (pc=0x000000000000c038)
  0x000000000000c018:   
  [error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xc0000005]
  
  Register to memory mapping:
  
  RAX=0x0000000000000000 is an unknown value
  RBX=0x0000000000000015 is an unknown value
  RCX=0x00000000fffffff4 is an unknown value
  RDX=0x000000014000d040 is an unknown value
  RSP=0x000000000238f668 is pointing into the stack for thread: 0x000000000211b000
  RBP=0x000000000238f858 is pointing into the stack for thread: 0x000000000211b000
  RSI=0x0000000000000001 is an unknown value
  RDI=0x00000000000000fc is an unknown value
  R8 =0x000000000238f878 is pointing into the stack for thread: 0x000000000211b000
  R9 =0x00000000065cc490 is an unknown value
  R10=0x00000000023a21bc is an Interpreter codelet
  method entry point (kind = native)  [0x00000000023a1f40, 0x00000000023a27c0]  2176     bytes
  R11=0x000000005b958940 is an unknown value
  R12=0x0000000000000000 is an unknown value
  R13=0x000000073b0739e0 is an oop
  {method} 
   - klass: {other class}
  R14=0x000000014000d570 is an unknown value
  R15=0x000000000211b000 is a thread
  
  
  Stack: [0x0000000002290000,0x0000000002390000],  sp=0x000000000238f668,  free space=1021k
  Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
  C  0x000000000000c038
  j  test.print()V+9
  j  Main.main([Ljava/lang/String;)V+10
  v  ~StubRoutines::call_stub
  
  Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
  j  wecker.setWakeupTime(Ljava/util/Date;)Z+0
  j  wecker.print()V+9
  j  Main.main([Ljava/lang/String;)V+10
  v  ~StubRoutines::call_stub
  
  ---------------  P R O C E S S  ---------------
  
  Java Threads: ( =&gt; current thread )
    0x00000000065a9000 JavaThread "Service Thread" daemon [_thread_blocked, id=5300,     stack(0x0000000007840000,0x0000000007940000)]
    0x00000000065a7800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=7416,     stack(0x0000000007690000,0x0000000007790000)]
    0x0000000006594000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=4656, stack(0x00000000074d0000,0x00000000075d0000)]
    0x0000000006591000 JavaThread "Attach Listener" daemon [_thread_blocked, id=5864, stack(0x00000000073b0000,0x00000000074b0000)]
    0x000000000658c000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=7252, stack(0x0000000007260000,0x0000000007360000)]
    0x0000000002067000 JavaThread "Finalizer" daemon [_thread_blocked, id=2840, stack(0x0000000007060000,0x0000000007160000)]
    0x000000000205e800 JavaThread "Reference Handler" daemon [_thread_blocked, id=8056,     stack(0x0000000006e30000,0x0000000006f30000)]
  =&gt;0x000000000211b000 JavaThread "main" [_thread_in_native, id=4640,     stack(0x0000000002290000,0x0000000002390000)]
  
  Other Threads:
    0x0000000002055000 VMThread [stack: 0x0000000006c00000,0x0000000006d00000] [id=8016]
    0x00000000065c2000 WatcherThread [stack: 0x0000000007a70000,0x0000000007b70000] [id=6884]
  
  VM state:not at safepoint (normal execution)
  
  VM Mutex/Monitor currently owned by a thread: None
  
  Heap
   PSYoungGen      total 57344K, used 983K [0x00000007c0000000, 0x00000007c4000000,     0x0000000800000000)
    eden space 49152K, 2% used [0x00000007c0000000,0x00000007c00f5c98,0x00000007c3000000)
    from space 8192K, 0% used [0x00000007c3800000,0x00000007c3800000,0x00000007c4000000)
    to   space 8192K, 0% used [0x00000007c3000000,0x00000007c3000000,0x00000007c3800000)
   PSOldGen        total 131072K, used 0K [0x0000000740000000, 0x0000000748000000, 0x00000007c0000000)
    object space 131072K, 0% used [0x0000000740000000,0x0000000740000000,0x0000000748000000)
   PSPermGen       total 21248K, used 2569K [0x000000073ae00000, 0x000000073c2c0000, 0x0000000740000000)
    object space 21248K, 12% used [0x000000073ae00000,0x000000073b0827c8,0x000000073c2c0000)
  
  Code Cache  [0x0000000002390000, 0x0000000002600000, 0x0000000005390000)
   total_blobs=169 nmethods=0 adapters=136 free_code_cache=48773Kb     largest_free_block=49943680
  
  Dynamic libraries:
  0x000000013f530000 - 0x000000013f563000     C:\Windows\system32\java.exe
  0x0000000077730000 - 0x00000000778d9000     C:\Windows\SYSTEM32\ntdll.dll
  0x0000000077610000 - 0x000000007772f000     C:\Windows\system32\kernel32.dll
  0x000007fefde10000 - 0x000007fefde7c000     C:\Windows\system32\KERNELBASE.dll
  0x00000000707d0000 - 0x000000007081a000     D:\Program Files\AVAST     Software\Avast\snxhk64.dll
  0x000007feff7f0000 - 0x000007feff8cb000     C:\Windows\system32\ADVAPI32.dll
  0x000007fefe7b0000 - 0x000007fefe84f000     C:\Windows\system32\msvcrt.dll
  0x000007feff970000 - 0x000007feff98f000     C:\Windows\SYSTEM32\sechost.dll
  0x000007fefe3e0000 - 0x000007fefe50d000     C:\Windows\system32\RPCRT4.dll
  0x0000000077510000 - 0x000000007760a000     C:\Windows\system32\USER32.dll
  0x000007fefe360000 - 0x000007fefe3c7000     C:\Windows\system32\GDI32.dll
  0x000007fefe3d0000 - 0x000007fefe3de000     C:\Windows\system32\LPK.dll
  0x000007fefe900000 - 0x000007fefe9c9000     C:\Windows\system32\USP10.dll
  0x000007fefc360000 - 0x000007fefc554000         C:\Windows\WinSxS\amd64_microsoft.windows.common-    controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll
  0x000007fefe9d0000 - 0x000007fefea41000     C:\Windows\system32\SHLWAPI.dll
  0x000007feffa10000 - 0x000007feffa3e000     C:\Windows\system32\IMM32.DLL
  0x000007fefe250000 - 0x000007fefe359000     C:\Windows\system32\MSCTF.dll
  0x0000000062860000 - 0x0000000062931000     D:\Program Files\Java\jre7\bin\msvcr100.dll
  0x000000005b7a0000 - 0x000000005be7a000     D:\Program     Files\Java\jre7\bin\server\jvm.dll
  0x000007fefabf0000 - 0x000007fefabf9000     C:\Windows\system32\WSOCK32.dll
  0x000007fefe850000 - 0x000007fefe89d000     C:\Windows\system32\WS2_32.dll
  0x000007feff7e0000 - 0x000007feff7e8000     C:\Windows\system32\NSI.dll
  0x000007fefbc40000 - 0x000007fefbc7b000     C:\Windows\system32\WINMM.dll
  0x0000000077900000 - 0x0000000077907000     C:\Windows\system32\PSAPI.DLL
  0x0000000062a10000 - 0x0000000062a1f000     D:\Program Files\Java\jre7\bin\verify.dll
  0x00000000629e0000 - 0x0000000062a08000     D:\Program Files\Java\jre7\bin\java.dll
  0x00000000629c0000 - 0x00000000629d5000     D:\Program Files\Java\jre7\bin\zip.dll
  0x0000000140000000 - 0x0000000140012000             C:\Users\xx\workspace\test\src\wakeup64.dll
  
  VM Arguments:
  java_command: Main
  Launcher Type: SUN_STANDARD
  
  Environment Variables:
  PATH=C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD     APP\bin\x86;D:\Program Files\Common Files\Microsoft Shared\Windows Live;D:\Program Files     (x86)\Common Files\Microsoft Shared\Windows     Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow    erShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program     Files (x86)\Windows Live\Shared;D:\Program Files(x86)\Android\android-sdk\platform-    tools\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;D:\Program     Files\Java\jdk1.7.0_02\bin;D:\MinGW\bin;D:\Program Files (x86)\Microsoft Visual Studio     9.0\VC\bin
  USERNAME=xx
  OS=Windows_NT
  PROCESSOR_IDENTIFIER=AMD64 Family 16 Model 5 Stepping 2, AuthenticAMD
  
  
  
  ---------------  S Y S T E M  ---------------
  
  OS: Windows 7 , 64 bit Build 7601 Service Pack 1
  
  CPU:total 4 (4 cores per cpu, 1 threads per core) family 16 model 5 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, popcnt, mmxext, 3dnowpref, lzcnt, sse4a
  
  Memory: 4k page, physical 12581048k(7862816k free), swap 25160244k(19112368k free)
  
  vm_info: Java HotSpot(TM) 64-Bit Server VM (22.1-b02) for windows-amd64 JRE (1.7.0_03-b05), built on Feb  3 2012 20:43:56 by "java_re" with unknown MS VC++:1600
  
  time: Sun Jul 29 01:02:23 2012
  elapsed time: 0 seconds
  </code></pre>
  
  <p>Anyone allready encountered this?</p>