running the demo code as-is worked OK for me
i.e. no problems at all with
final TrayIcon trayIcon = new TrayIcon(createImage("images/bulb.gif","tray icon"));
probably nothing to do with why the toolkit didn't work, but your image names are diferent
Hall Nation wrote:It works fine for all of us.
Any specific IDE that you use?
Only thing we can think of, is wrong path for the "images" folder.. OR wrong image name.
agreed.. and if he is getting that main not found error, then he is missing the point of packages there..
@Ramy : why dont you post your exact error that came before you altered the code? and did you observe the "package misc " statement in the source file?
This message was edited 1 time. Last update was at by Shrinath M Aithal
I tried the program again with the two new lines below :
instead of
Curiously, I also faced the same problem as the OP faced. It wouldn't take the bulb image in the specific path (eventhough it was present), but the menu et all did work. The original program worked like a charm though. Still trying to figure out why the other approach didn't work.
This message was edited 2 times. Last update was at by Hall Nation
Toolkit.getImage uses a file name, whereas the createImage uses a resource name. The former is relative to the current directory. The second is relative to the class file. Except when you are executing your Java program from the same folder as the class file, these two are different.