What have I changed: in Sample1.java main function now is: public static void main(String[] args) { System.loadLibrary("Sample1"); Sample1 sample = new Sample1(); int square = sample.intMethod(5); boolean bool = sample.booleanMethod(true); String text = ""; for(int i=0; i<1000; i++){ text = sample.stringMethod("JAVA"+i); } int sum = sample.intArrayMethod(new int[]{1,1,2,3,5,8,13} ); System.out.println("intMethod: " + square); System.out.println("booleanMethod: " + bool); System.out.println("stringMethod: " + text); System.out.println("intArrayMethod: " + sum); }
in Sample1.nim proc Java_Sample1_stringMethod now is: proc Java_Sample1_stringMethod(env: ptr JNIEnv, obj: jobject, input: jstring): jstring {.JNIEXPORT.} = var isCopy: jboolean var str = env[].GetStringUTFChars(env, input, isCopy) var cap = $str cap.add("test") env[].ReleaseStringUTFChars(env, input, str) result = env[].NewStringUTF(env, cap) Then I get EXCEPTION_ACCESS_VIOLATION (0xc0000005) tested with: > javac 1.8.0_20 > > java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b18) > Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) > > gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.3.0 > > Nim Compiler Version 0.14.3 (2016-07-13) [Windows: amd64] Thanks...