Getting null error from User32.INSTANCE in Java

78 views
Skip to first unread message

Greg Brignola

unread,
Jul 5, 2022, 8:57:53 AM7/5/22
to Java Native Access
I have a demo project in VS Code using JAVA that calls to:

com.sun.jna.platform.win32.User32 user32 = com.sun.jna.platform.win32.User32.INSTANCE;
        WinDef.HWND hwnd = user32.FindWindow(null, "[my window title here]");
        System.out.println("[my window title here] = " + hwnd);

This process works with no issues in a small demo project.

When calling the same code in my main project, Java throws an exception : "com.sun.jdi.InvocationException: Exception occurred in target VM occurred invoking method.."

I'm just not sure where to go from here.

Matthias Bläsing

unread,
Jul 5, 2022, 11:57:58 AM7/5/22
to jna-...@googlegroups.com
Hi Greg,
please show the full stack trace - you cut where it begins to get
interesting.

The issue looks strang though: com.sun.jdi.InvocationException is an
exception thrown from the java debugging interface and is not thrown
from JNA.

Greetings

Matthias
Reply all
Reply to author
Forward
0 new messages