Java Open in the browser (Chrome only)

This code can’t be simpler. However, it does nothing (except for outputting my print statement).

I use a desktop Java application Set Chrome as the default browser in the program.

What am I missing? Thanks!

String url = "https://www.google.com/";
try {
if (java.awt.Desktop.isDesktopSupported( ))
System.out.println("yes");
else System.out.println("no");
java.awt.Desktop.getDesktop().browse(java .net.URI.create(url));
System.out.println("here");
} catch (IOException e) {
System.err.println("exception thrown ");
e.printStackTrace();
}
System.out.println("done");

My exact output is this:

yes
here
done

Edit: I switched my default browser from Chrome to Firefox, Now it works. Why doesn’t Chrome respond to this?

I have the same problem: Desktop.getDesktop(). Browser (URI) is not applicable It works on Google Chrome, but it works fine as the default browser on Firefox.

I reinstalled Chrome and selected “Set as default browser” using Google installer.

< p>Then, I tested it and Chrome was running. I debugged it and Chrome was useless.

Conclusion: Chrome can run when using Run. Chrome can’t run when using Debug.

This code can’t be simpler. However, it does nothing (except for outputting my print statement).

I am using a desktop Java application Set Chrome as the default browser in the program.

What am I missing? Thanks!

String url = "https://www.google.com/";
try {
if (java.awt.Desktop.isDesktopSupported( ))
System.out.println("yes");
else System.out.println("no");
java.awt.Desktop.getDesktop().browse(java .net.URI.create(url));
System.out.println("here");
} catch (IOException e) {
System.err.println("exception thrown ");
e.printStackTrace();
}
System.out.println("done");

My exact output is this:

yes
here
done

Edit: I switched my default browser from Chrome to Firefox, Now it works. Why doesn’t Chrome respond to this?

I ran into the same problem: Desktop.getDesktop(). The browser (URI) is not available for Google Chrome, but it is used as the default browser on Firefox The browser is working properly.

I reinstalled Chrome and selected “Set as the default browser” using Google installer.

Then I tested it and Chrome was running .I debugged it, Chrome is useless.

Conclusion: When using Run, Chrome can run. When using Debug, Chrome can’t run.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4337 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.