java.lang.NoClassDefFoundError: com/sun/jna/platform/win32/Shell32
See original GitHub issueI am using appdirs
in a JavaFX application. appdirs throws exception in Windows 7 as below:
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
java.lang.NoClassDefFoundError: com/sun/jna/platform/win32/Shell32
at net.harawata.appdirs.impl.ShellFolderResolver.resolveFolder(ShellFolderResolver.java:38)
at net.harawata.appdirs.impl.WindowsAppDirs.getLocalAppData(WindowsAppDirs.java:71)
at net.harawata.appdirs.impl.WindowsAppDirs.getUserDataDir(WindowsAppDirs.java:33)
at net.harawata.appdirs.AppDirs.getUserDataDir(AppDirs.java:28)
at com.erayerdin.corpustk.App.<clinit>(App.java:19)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$155(LauncherImpl.java:352)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformI
mpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.platform.win32.Shell32
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
It works in Linux, though. Adding com.sun.jna
as a Maven dependency does not work as well.
Environment
- Microsoft Windows [Version 6.1.7601] (stands for Windows 7)
- Java™ SE Runtime Environment (build 1.8.0_151-b12)
- Appdirs 1.0.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Webdriver error : java.lang.NoClassDefFoundError: com/sun ...
Your issue is due to missing jar that contains : com/sun/jna/platform/win32/Kernel32. You should be able to download it with its dependency here:.
Read more >Could not initialize class com.sun.jna.Native - Google Groups
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native at com.sun.jna.platform.win32.Shell32.<clinit>(Shell32.java:32)
Read more >issues with "com/sun/jna/platform/win32/Win32Exception ...
7, I am facing java.lang.NoClassDefFoundError: com/sun/jna/platform/win32/Win32Exception for my couple of flows, which was working fine earlier.
Read more >jna-platform 5.12.1 javadoc (net.java.dev.jna)
Provides common library mappings for COM Type Library implementations. com.sun.jna.platform.win32.COM.util. Provides COM Utilities. com.sun.jna.
Read more >com/sun/jna/Platform with FileBot 4.9.0 and Fedora 31
BluRay.H264.AAC-RARBG..mp4] com/sun/jna/Platform java.lang.NoClassDefFoundError: com/sun/jna/Platform at net.filebot.MetaAttributeView.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm that 1.0.1 solves problem. Thanks!
@erayerdin ,
No worries. I appreciate you took the time to report this!
@zak-pawel is right (thanks for the help!). I checked the dependency and it is
jna-platform
that is required by appdirs (jna
is also required, but it will be automatically added becausejna-platform
depends on it).Anyway, to make things simpler, I have modified the scope of
jna-platform
dependency tocompile
and released 1.0.1.