Java SystemTray icon -


there a simple tutorial on implementing system tray icon.

the problem is, can see icon in tray if run app eclipse, can't see if export , run runnable jar file. have other images in app work fine form same folder.

the tray working (left , right click on it) doesn't show image, can see in image (the jar file on top, eclipse on bottom):

example of missing image

why? thank , sorry english!

edit: found solution image need accessed whit:

image img = toolkit.getdefaulttoolkit().getimage(myclass.class.getresource("/images/asd.png")); 

the problem way include image file. will have include image in jar when create it, , have access image in different manner:

try {     inputstream = classloader.getsystemclassloader().getresourceasstream("wing16.png");     bufferedimage img = imageio.read(is); } catch (ioexception e) {} 

you can used img variable set image in jar.

update:

take of class files & images , go command line:

jar -cvfm test.jar manifest.mft *.class image.png

replace manifest.mft manifest file name. replace image.png image want show (you can include more images if need to)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -