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 6074895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:26:00+00:00 2026-05-23T10:26:00+00:00

Hello good Stack Overflow people, I do have a business problem and would like

  • 0

Hello good Stack Overflow people,
I do have a business problem and would like to get some answers/pointers/ideas on how to go about solving it. perhaps this has been mentioned in some other topic but so far I searched the internet but not able to find a straight answer..

Business Problem: One of our clients would like to have a Java web based application but launched as a desktop application. i.e. the client would like to double click on an icon some where on their desktop and get a browser window launched pointing to the URL/context of the web application which will be running locally on a Jetty server that will get started up when the user clicks on the icon.

So far I have figured out how to package my application and create an exe launcher (using install4j) (basically i created an executable jar file with jetty server and my web app packaged together with a startup class that will start Jetty server and point it to the context of the web application).

My problem is I have no idea how to start up a (native) web browser and point it to the URL/context of the web app.

I have found this code that launch the user’s default browser:

String url = "http://www.google.com";
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));

which is good but not good enough. and the reason its not good enough is that when the user close the browser the Jetty server would still be running in the back ground. What I want is when the user closes the browser I also want to detect this event and close down the Jetty server (without using any active X or JavaScript please)

Some one have mentioned creating a JPanel and include a native browser inside it using some DJ native swing API but I have no clue as how to do this.

Any ideas?

Many thanks in advance

  • 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-05-23T10:26:01+00:00Added an answer on May 23, 2026 at 10:26 am

    Here is a piece of code just FYI. You can fork native browser in a process and return a java Process object to your java code. You can invoke the processObject.waitFor() method to wait for the invoked process to terminates.

    The Launcher :

    public class Launcher implements Runnable {
    
        public void run() {
            Process p;
            try {
                p = Runtime.getRuntime().exec("notepad.exe");
                p.waitFor();
    
                // Do something after the forked process terminates
                System.out.println("The browser is exit");
            } catch (IOException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    

    The main class:

    public class TestProcess {
    
        public static void main(String[] args) throws Exception {
            new Thread(new Launcher()).run();
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have gone through similar questions on Stackoverflow but still can't get a good
Why hello there Stackoverflow, I have a nutcracker for ya, is there an good
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello I am compiling a program with make but I get the error of
Hello we have an SQL server application running over a low bandwith connection. We
Hello any one knows a good tutorial where i can find a pointer to
Hello can somebody write or point to a good symfony plugin installation tutorial. Here
Hello i have structures declared in the same Header file that need eachother. struct
Hello generous computerists! So I have a launchd plist item that is calling the
Hello again ladies and gents! OK, following on from my other question on ASP.NET

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.