code: public static void addTray(final Image image, final String name, 
          final PopupMenu popup)
          {
          final Class[] trayIconArgTypes = new Class[] {
              java.awt.Image.class, 
              java.lang.String.class, 
              java.awt.PopupMenu.class
          };
          try
              {
              final Class trayIconClass = Class.forName("java.awt.TrayIcon");
              final Constructor trayIconConstructor = 
                  trayIconClass.getConstructor(trayIconArgTypes);
              final Object trayIcon = 
                  trayIconConstructor.newInstance(image, name, popup);
              
              final Class trayClass = Class.forName("java.awt.SystemTray");
              final Object obj = 
                  trayClass.getDeclaredMethod("getSystemTray").invoke(null);
              
              final Class[] trayAddArgTypes = new Class[] {
                  trayIconClass 
              };
              trayClass.getDeclaredMethod("add", trayAddArgTypes).invoke(obj, trayIcon);
              }
          catch (final Exception e)
              {
              LOG.warn("Reflection error", e);
              }
          }
docs: Adds a tray icon using reflection.  This succeeds if the underlying
  JVM is 1.6 and supports the system tray, failing otherwise.
  
  @param image The image to use for the system tray icon.
  @param name The name of the system tray item.
  @param popup The popup menu to display when someone clicks on the tray.