private void createAndAddApplicationToSystemTray() throws IOException {
		// Check the SystemTray support
		if (!SystemTray.isSupported()) {
			System.out.println("SystemTray is not supported");
			return;
		}
		Image image = new ImageIcon("").getImage();
		final TrayIcon trayIcon = new TrayIcon(image, TOOL_TIP);
		this.processTrayIcon = trayIcon;

		ApiProperties.get().setToken(DbReader.getToken(processTrayIcon));
		final SystemTray tray = SystemTray.getSystemTray();
		final PopupMenu popup = new TrayMenu(tray, trayIcon);

		trayIcon.setPopupMenu(popup);
		trayIcon.setImageAutoSize(true);

		try {
			tray.add(trayIcon);
		} catch (AWTException e) {
			System.out.println("TrayIcon could not be added.");
			return;
		}

		// Add listener to trayIcon.
		trayIcon.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				JOptionPane.showMessageDialog(null,
						"This dialog box is run from System Tray");
			}
		});

	}