1 import java.awt.Desktop;
2 import java.io.IOException;
3 import java.net.URI;
4 import java.net.URISyntaxException;
5
6
7 public class TestDesktopMail {
8 /**
9 * @param args
10 * @throws URISyntaxException
11 * @throws IOException
12 */
13 public static void main(String[] args) throws IOException, URISyntaxException {
14 if (Desktop.isDesktopSupported()) {
15 Desktop desktop = Desktop.getDesktop();
16 desktop.mail(new URI("mailto:"));
17 } else {
18 System.out.println("不支持desktop");
19 }
20 }
21 }
22
2 import java.io.IOException;
3 import java.net.URI;
4 import java.net.URISyntaxException;
5
6
7 public class TestDesktopMail {
8 /**
9 * @param args
10 * @throws URISyntaxException
11 * @throws IOException
12 */
13 public static void main(String[] args) throws IOException, URISyntaxException {
14 if (Desktop.isDesktopSupported()) {
15 Desktop desktop = Desktop.getDesktop();
16 desktop.mail(new URI("mailto:"));
17 } else {
18 System.out.println("不支持desktop");
19 }
20 }
21 }
22
沒啥好說的,繼續看代碼的吧