Hi. I am trying to use the Desktop API to open a text file in the default text viewer. I have downloaded the demo from the java tutorial and it works fine. However, for some reason I can't figure out, I am getting the error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
I have the text file in the current working directory.
I have imported the Desktop package with the following line:
I have created an instance of Desktop called desktop:
I have a button, called openTextFileButton which when pressed invokes the following code:
Could someone tell me what I am doing wrong?
Thanks in advance. [ July 24, 2007: Message edited by: Sam Bluesman ]