diff --git a/bindings/java/src/jni/javasigar.c b/bindings/java/src/jni/javasigar.c index f22500e7..6bd2ca70 100644 --- a/bindings/java/src/jni/javasigar.c +++ b/bindings/java/src/jni/javasigar.c @@ -77,6 +77,12 @@ static void sigar_throw_notimpl(JNIEnv *env, char *msg) # define SIGAR_ENOENT ENOENT #endif +#ifdef WIN32 +# define SIGAR_EACCES ERROR_ACCESS_DENIED +#else +# define SIGAR_EACCES EACCES +#endif + static void sigar_throw_error(JNIEnv *env, jni_sigar_t *jsigar, int err) { jclass errorClass; @@ -86,6 +92,10 @@ static void sigar_throw_error(JNIEnv *env, jni_sigar_t *jsigar, int err) errorClass = SIGAR_FIND_CLASS("SigarFileNotFoundException"); break; + case SIGAR_EACCES: + errorClass = SIGAR_FIND_CLASS("SigarPermissionDeniedException"); + break; + case SIGAR_ENOTIMPL: if (jsigar->not_impl == NULL) { jfieldID id;