How can I solve the problem?
I assume that you are trying to use getSystemIcon
not getFileIcon
. (The latter doesn't exist!)
And I assume that you are trying to use it on a non-Windows platform. Unfortunately getSystemIcon
on a non-Windows system will only give you a generic file or directory?
Why? Because that is all that they have implemented in the OpenJDK codebase!
But why? My guess is ... because there is no single standard way to get file type icons on generic Linux & Linux platforms. To illustrate, review the answers to this:
A Linux / Unix implementation in OpenJDK would need to interact with many different native window managers, each of which handle this issue differently. It would be a lot of work for the Java team to implement and maintain compatibility with a cat-herd of window managers.
While Oracle / OpenJDK Java are committed to supporting AWT + Swing as part of the Java platform, they don't appear to be investing many resources in enhancing them. You could say that HTML 5 and Android have won.