Answer the question
In order to leave comments, you need to log in
How to throw a JNA exception up?
Let me explain the question in code:
public static void main(String... args) {
User32 user32 = Native.loadLibrary("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS);
try {
user32.EnumChildWindows(
null /*hWnd, с таким аргументом выхов callback произойдет*/,
(hWnd, data) -> {
throw new RuntimeException("Test");
},
null /*data*/);
System.out.println("Test exception is not catched :("); // Попадаем сюда
} catch (Throwable t) {
System.out.println("Test exception catched :)"); // А хотелось бы сюда
}
}
Native.setCallbackExceptionHandler
, but the result is the same.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question