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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Desktop class problem

843807Aug 11 2010 — edited Aug 12 2010
The code below does nothing. No file opened, no exception thrown, no output.
What can I do to discover the problem?
It does indeed execute the desktop.open(file) line.
Using JDK 1.16.0_81
File file = new File(pathAndFileString); // an existing text file
if (Desktop.isDesktopSupported()) {
	Desktop desktop = Desktop.getDesktop();
	if (desktop.isSupported(Desktop.Action.OPEN )) {
		try {
			desktop.open(file);
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
	else {
		System.out.println("Desktop.Action.OPEN not supported");
	}
}
else {
	System.out.println("Desktop not supported");
}

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 9 2010
Added on Aug 11 2010
8 comments
3,598 views