I have created a hashmap class which contains details of process name , id and its usage and using hashentry class I've stored values for each Table[i]. Problem is i'can access upto HASHMAP class cant go upto HASHENTRY error occurs.
My NATIVE code in CPlusPlus :
//ProcessManagement.h
JNIEXPORT void JNICALL Java_newjni_JNITest_sayHello (JNIEnv*, jobject)
{
    printf("HelloWorld\n");
    HashMap hash;
    int x = hash.get(3);
    printf("%d", x);
    return;
}
 // ProcessInfo.h
 // In hashmapentry class
 .
 .
 .
   HashEntry(int ke, int valu, string nam, int memusag, int cpuusag, double 
    diskusag, double netusag, string unam) {
    this->key = ke;
    this->value = valu;
    this->name = nam;
    this->memusage = memusag;
    this->cpuusage = cpuusag;
    this->diskusage = diskusag;
    this->netusage= netusag;
    this->uname= unam;
  }
   //In hashMap class
   .
   .
   .
     void put(int ke, int valu, string nam, int memusag, int cpuusag, double 
     diskusag, double netusag, string use) {
    int hash = ke;
    table[hash] = new HashEntry(ke, valu, nam, memusag, cpuusag, diskusag, 
    netusag, use);
    }
  //ProcessManagement.cpp
  .
  .
  //used windows api to get values of process
   hash.put(i, (int)pid[i], pname, memusage, cpuusage[i], diskusage, netusage, 
   s);
  .
  .
  .
In JAVA :
 public class JNITest {  // Save as HelloJNI.java
 static {
    System.loadLibrary("ProcessHash"); 
}
 private native void sayHello();
 private native void print();
 public static void main(String[] args) {
    new JNITest().sayHello();  // Create an instance and invoke the native method
 }
 }
And the error occurs for me is :
#
# A fatal error has been detected by the Java Runtime Environment:
#
 #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffcf33417dd, pid=12584, tid=4912
#
# JRE version: 6.0_32-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.7-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [ProcessHash.dll+0x217dd]
#
# An error report file with more information is saved as:
# C:\Users\MrBean\Documents\NetBeansProjects\newJNI\hs_err_pid12584.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
HelloWorld
ERROR LOG : https://textsaver.flap.tv/lists/356y
 NITHISH SIDDHARTHAN V • edited Feb 2, 2020 by
 NITHISH SIDDHARTHAN V • edited Feb 2, 2020 by User contributions licensed under CC BY-SA 3.0