java NoClassDefFoundError 使用 jna.jar 和 platform.jar

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14746900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 17:15:33  来源:igfitidea点击:

NoClassDefFoundError using jna.jar and platform.jar

javaswinginternet-explorer-9java-native-interfacejna

提问by nayden

I need to find a way to change the settings of proxy on the IE 9.

我需要找到一种方法来更改 IE 9 上的代理设置。

I know a way directly in the reg., but ie9 doesn't refresh after I set them. I tried to use another solution with jna:

我直接在 reg. 中知道一种方法,但是 ie9 在我设置它们后不会刷新。我尝试对 jna 使用另一种解决方案:

Invoke WinInet Functions Used Java + JNA

使用 Java + JNA 调用 WinInet 函数

In my case I use only:

就我而言,我只使用:

System.out.println("Set refreshed...");

if (!WinInet.INSTANCE.InternetSetOption(
    hInternet, WinInet.INTERNET_OPTION_REFRESH, (Pointer) null, len)) {
        System.out.println("InternetSetOption failed!:"
            + Kernel32.INSTANCE.GetLastError());

but I get this error:

但我收到此错误:

Set refreshed...
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
    com/sun/jna/platform/win32/WinDef$DWORD

I downloaded the lib jars from here:

我从这里下载了 lib jars:

http://java.net/projects/jna/downloads/directory/3.3.0

http://java.net/projects/jna/downloads/directory/3.3.0

Thank you.

谢谢你。

回答by TheWhiteRabbit

makesure you have platform-3.4.0.jarand jna-3.4.0.jarin your classpath

makesure你platform-3.4.0.jarjna-3.4.0.jar你的类路径