Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

import statement throws exception

843805Nov 28 2005 — edited Nov 28 2005
Hey,

I just added the code into my program to have a tray icon as is now supported in Java 1.6.0 "Mustang". Really easy and straight forward to do.

Trouble is that the program will throw an exception if run on 1.4.2 or 1.5.0. The icon is a convenience not a necessity so I want to be able to allow the program to run on any of these platforms.

Is there a way to import the classes other than using the import command and allow the program to catch the exception and respond with something like JOptionPane.showmessagedialog(frame,"Upgrade to Mustang to have tray icon");

I thought about catching the exception when the class with the import statements is called, but that would cause the object to be null and would cause NullPointerExceptions all over my application.

Any suggestions?

Thanks,
DAvid
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 26 2005
Added on Nov 28 2005
1 comment
236 views