Set the default location for compiling Include header files under the settings:
Linux:
1. Modify /etc/profile or ~/.bashrc and add:
export CPATH=$CPATH:$JAVA_HOME/include:$JAVA_HOME/include/linux
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$JAVA_HOME/include:$JAVA_HOME/include/linux
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$JAVA_HOME/include:$JAVA_HOME/include/linux
2. Re-exit the current user, and then enter
PS Some answers say to set C_INCLUDE_PATH and CPP_INCLUDE_PATH, so it does not take effect for G++, C++ should set CPLUS_INCLUDE_PATH, C should set C_INCLUDE_PATH, CPATH is effective for both C and C++ Therefore, it is recommended to set both.
Windows:
1. You should only need to set JAVA_HOME/include to the default include location of the development tool. I haven't tried it, and I will add it later after testing.