import java.awt.Desktop;问题

来源:百度知道 编辑:UC知道 时间:2024/07/05 04:19:11
导入这个包出现错误提示.是不是因为lib里面没这个jar包...这个包是不是自己下.?
在线等..

看看你的jdk的版本是不是1.6,1.6才有这个类Desktop。
如果是1.5或者以下版本,没有这个类。

java.awt
Class Desktop
java.lang.Object
java.awt.Desktop

--------------------------------------------------------------------------------

public class Desktopextends ObjectThe Desktop class allows a Java application to launch associated applications registered on the native desktop to handle a URI or a file.

Supported operations include:

launching the user-default browser to show a specified URI;
launching the user-default mail client with an optional mailto URI;
launching a registered application to open, edit or print a specified file.
This class provides methods corresponding to these operations. The methods look for the associated application registered on the current platform, and launch it to handle a URI or file. If there is no associated application or the associated application fails to be launched, an exception is thrown.