views:

476

answers:

3

I am converting code from jdk 1.6 to jdk 1.5 and the code is:

import java.awt.SystemTray;

public static void main(String[] args) {
    if (SystemTray.isSupported()) {
        SystemTray tray = SystemTray.getSystemTray();
    }

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

Could you guys tell me what will be the compatible code for this?

+1  A: 

You need external (probably JNI) libraries to support that in Java 5. Here is an example for Windows.

kd304
+1  A: 

java.awt.SystemTray is not a part of JDK 5 so you will need some external libraries, e.g. Systray.

Bombe
+3  A: 

You can try any one of them

JDIC (JDesktop Integration Components)

JTray

Rahul Garg