Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:37:40+00:00 2026-06-17T15:37:40+00:00

I am trying to add a link to an about window in an application

  • 0

I am trying to add a link to an “about” window in an application that will link to my Github. I sort of know the process, however, it seems to complicated for what it does, with all the error catching I have to put in. As I am certain the URI syntax is correct, is there any way to skip this catch? This variable stays final, and unless the syntax of resource location changes, it should be OK

Code:

        //TODO: Simplify?
        String gitLocation = "https://github.com/DanubeRS";
        try {
            final URI gitUri = new URI(gitLocation);

            //Add the github button action (link to site)
            githubButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        Desktop.getDesktop().browse(gitUri.resolve(gitUri));  //Try to open URL
                    } catch (IOException e1) {
                        //URI unresolvable
                        e1.printStackTrace();
                    }
                }
            });
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:37:41+00:00Added an answer on June 17, 2026 at 3:37 pm

    You could use the convenience method URI.create(String str), which wraps the URISyntaxException with an IllegalArgumentException. From the JavaDoc:

    This method is provided for use in situations where it is known that
    the given string is a legal URI, for example for URI constants
    declared within in a program, and so it would be considered a
    programming error for the string not to parse as such. The
    constructors, which throw URISyntaxException directly, should be used
    situations where a URI is being constructed from user input or from
    some other source that may be prone to errors.

    The IOException thrown from Desktop.browse() indicates that there’s no default browser set up. You should probably handle that gracefully by notifying the user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a method that will add a node to my linked
I'm trying to set up a Google map that will display when a link
I'm trying to add a Settings link inside a partial that show/hide when hovered.
I'm trying to write a function in jQuery that will add a class to
I am working on an application that someone else wrote, trying to add some
I'm trying to create a link that will hide or show a part of
Am trying to add a link besides the Edit | Delete links in wordpress
Hi in my app when i was trying to add a link in textview
I am trying to add arrow to accordion main title link if it has
I'm trying to add an arrow image to my link and have it positioned

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.