Anyone had any success with <Desktop>.open() in 1.6?

L

Lee Weiner

I've been playing around with the new Desktop class in 1.6. I've
gotten the mail() and browse() methods to work as advertised, but
not the open() method. Example code:

import java.awt.Desktop;
import java.io.*;

public class DesktopTest
{
public static void main ( String[] args )
{
System.out.println( "Desktop supported?: " +
Desktop.isDesktopSupported() );
Desktop desk = Desktop.getDesktop();

try
{
File file = new File( "d:\\basic.txt" );
System.out.println( "File exists?: " + file.exists() );
desk.open( file );
}
catch( IOException exc )
{
System.out.println( exc.getMessage() );
}
}
}

Both println's display "true", but I get no window, no exception,
no nuttin'. Also tried the edit() method with same results. Text
files are associated with Notepad on my system. If I double-click
basic.txt in Windows Explorer, Notepad opens.

Lee Weiner
lee AT leeweiner DOT org
 
I

IchBin

Lee said:
I've been playing around with the new Desktop class in 1.6. I've
gotten the mail() and browse() methods to work as advertised, but
not the open() method. Example code:

import java.awt.Desktop;
import java.io.*;

public class DesktopTest
{
public static void main ( String[] args )
{
System.out.println( "Desktop supported?: " +
Desktop.isDesktopSupported() );
Desktop desk = Desktop.getDesktop();

try
{
File file = new File( "d:\\basic.txt" );
System.out.println( "File exists?: " + file.exists() );
desk.open( file );
[snip code]
Try this..
Desktop.open( file );
--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top