Thanks all! @jangko, I tried your code. It works.
But it exist one issue if I manipulate with 'cap' variable in proc Java_Sample1_stringMethod: for example cap.add("test") and in JAVA for(int i=0; i<1000; i++){ text = sample.stringMethod("JAVA"+i); } then I get: # A fatal error has been detected by the Java Runtime Environment: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) Because nim's GC does it. * * * I found a solution: in the Sample1.nim at start GC_disable() and later somewhere run proc with: GC_enable() GC_fullCollect() GC_disable() or does exist better solution?