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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:30:13+00:00 2026-05-18T01:30:13+00:00

I want for my program to be able to launch another copy of itself,

  • 0

I want for my program to be able to launch another copy of itself, this

new Thread(){
     public void run() {
             main.main(new String[]{});
     }
}.start();

is what I have thus far. And it works. (The main class, in main.java launches the rest of the program and serves a back-end throughout general operations).


Now though, when I press the close button on any of the windows, it will close them all down. The desired effect is for it only close one down.

I’ve tried various things with Application.ExitListener with no joy and I also tried opening up the new window with an alternative method:

main s = new main();
s.main(new String[]{});

I was considering getting the file path and then simply having it Runtime.getRuntime().exec(); itself from there. On this attempt, I was able to get the path fine but not the name of the .jar file.

  • 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-18T01:30:14+00:00Added an answer on May 18, 2026 at 1:30 am

    Now though, when I press the close button on any of the windows, it will close them all down

    Sounds like you are using:

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    

    that should be:

    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want my program to be able to launch any Windows game, and while
I want my Java program to be able to run external application in Ubuntu,
I want my program to be able to write files in a sequential format,
I want to write a little program which is able to work with Google
I want to be able to distribute a program in Linux without distributing the
I want to be able to play sound files in my program. Where should
I want to be able to figure out what port a particular program is
I want to save my program's DataModel objects to a file, and be able
In the program I am writing, I want to be able to import CSV
I am creating a c++ program, but I want to be able to offer

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.