I'm building an application to run in the tray. Of course, it has to display an icon in the tray, but I don't know why it doesn't work for me.
When I compile myself in IntelliJ, it all works nicely, but when I build the jar file it doesn't display the correct icon.
This is my code responsible for adding the icon
Image img =Toolkit.getDefaultToolkit().getImage("src/main/resources/bsx.png");
TrayIcon trayIcon = new TrayIcon(img, "Loop Driver", popupMenu);
trayIcon.setImageAutoSize(true);
trayIcon.setPopupMenu(popupMenu);
try{
systemTray.add(trayIcon);
} catch (AWTException e) {
throw new RuntimeException(e.getMessage());
}
when I compile in IntelliJ I have the icon I want in the tray
but when I build jar file I have
In Project Structure I have that
what am I doing wrong?
I try many solution and configuration but nothing work.