Hey guys,
when i call these two lines:
SystemInfo si = new SystemInfo();
OperatingSystem operatingSystem = si.getOperatingSystem();
the program produces the following error in the second line.
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jna.platform.win32.OleAuto.VariantClear(Lcom/sun/jna/platform/win32/Variant$VARIANT;)Lcom/sun/jna/platform/win32/WinNT$HRESULT;
at oshi.util.platform.windows.WmiUtil.enumerateProperties(WmiUtil.java:561)
at oshi.util.platform.windows.WmiUtil.queryWMI(WmiUtil.java:333)
at oshi.util.platform.windows.WmiUtil.selectObjectsFrom(WmiUtil.java:275)
at oshi.software.os.windows.WindowsOSVersionInfoEx.<init>(WindowsOSVersionInfoEx.java:51)
at oshi.software.os.windows.WindowsOperatingSystem.<init>(WindowsOperatingSystem.java:91)
at oshi.SystemInfo.getOperatingSystem(SystemInfo.java:92)
at de.adito.aditoweb.server.framework.licensesender.Main.main(Main.java:18)
I'm running it on Windows 10 Pro. Any help is appreciated.
As far as I can tell, you're having an issue with the JNA dependency.
That method seems to have been part of JNA since the beginning, so it shouldn't be a matter of having an older than supported JNA version.
Can you check if you have any JNA library in your classpath?
It could also result from having multiple different versions of JNA. But yeah... trace the JNA dependencies and you'll likely find the culprit.
Thanks guys, adjusting the version of all other jna-dependencies solved my problem.
What are the JNA dependency versions that you maintained? I am getting the same error. I have included jna-4.2.2 and jna-platform-4.2.2. Please help as early as possible
Hey,
when you use Oshi-version 3.4.3 it should work if you use JNA-version 4.4.0 for all JNA-Artifacts.
Thanks for the help. Its working now. I am using jna-4.4.0 and oshi version 3.4.4.