Java JNI:此操作仅在应用程序容器的上下文中有效

Nam*_*nge 1 java windows java-native-interface

在 Mac 上运行 JNI 失败后,我决定尝试在 Windows 上运行。我编译了我的 DLL,并将其放入java.library.path.

现在.. Java 给了我这个错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\path\to\dll\TheDll.dll: This operation is only valid in the context of an app container
Run Code Online (Sandbox Code Playgroud)

此操作仅在应用容器上下文中有效

什么?我试过用谷歌搜索这个,但没有显示任何相关性。奇怪的是,它在 Mac 上运行得很好。

这是什么原因?

Nam*_*nge 5

原来错误消息是由 Windows 生成的,并且是由这种古怪引起的:

我编译为 Windows Store DLL 而不是 Win32 DLL。可笑,但至少我找到了答案。