0
`if(!Taskbar.isTaskbarSupported()) {
            JOptionPane.showMessageDialog(null, "Taskbar isn't supported!","ERROR", JOptionPane.ERROR_MESSAGE); 
            System.exit(-1);
        }
        JFrame jf = new JFrame("Taskbar");
        jf.setSize(500, 250);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setVisible(true);
        Taskbar.getTaskbar().setIconImage();`

Even I imported still it gives me error on Taskbar. So I'm not able to use Taskbar. I want to display default icon on Taskbar but it's not working.

0

1 Answer 1

0

java.awt.Taskbar class introduced in JDK 9.

In its documentation:

public class Taskbar extends Object

Since:
    9

If the import cannot be resolved, that means you are porbably building with JDK 8 (hopefully its not earlier version :) )

Sign up to request clarification or add additional context in comments.

3 Comments

is there any solution to use Taskbar in JDK 8. I want to display the icon on taskbar.
17.0.4.1 this version is install in my PC. @Geoge Z
@AnjaliYadav As far as I know, there is no way to use the Taskbar in JDK 8. Installed Java version, and used Java version is a different thing. You can change the used version to JDK 9 and Taskbar import will be resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.