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

  • Home
  • SEARCH
  • 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 5966839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:51:24+00:00 2026-05-22T19:51:24+00:00

i ve written a simple program to run on a mac, the program opens

  • 0

i ve written a simple program to run on a mac, the program opens an excel file and waits for the the user to close the file after which a simple output is given. when i run the program, excel opens, the proc.waitfor is ignored and it just skips to the output without waiting, any help
thanks

  Thread myThread = new Thread() {

        @Override
        public void run() {
            try {
                String userDir = (System.getProperty("user.home"));

                String fileName = userDir + "/Desktop/test/testfile.xlsx";
                File theFile = new File(fileName);
                Process proc = new ProcessBuilder("/usr/bin/open", fileName).start();
                int waitFor = proc.waitFor();
            } catch (InterruptedException ex) {
                Logger.getLogger(MacTester.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(MacTester.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    };

    myThread.start();
    System.out.println("excel is now closed");
  • 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-22T19:51:25+00:00Added an answer on May 22, 2026 at 7:51 pm

    This line:
    System.out.println("excel is now closed");

    Should be inside the run method. Your main thread, the thread that is starting your other thread continues with the execution after start has been invoked.

    Another alternative is to place:
    myThread.join();

    on the line after:
    myThread.start();

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

Sidebar

Related Questions

I've written some code which is a mini simple imitation of messenger program. In
I'm struggling to compile and run a program on Mac OS X, which is
Ok, so I want to run simple opengl program that I've written, on other
I've written a small, in house C# program which batch converts between various file
I have written a simple C++ shell program to parse large XML files and
I'm having trouble with what should be a simple program. I've written a single
I've written a simple control which basically displays a few words with an image
I'm compiling a simple program written in C and I'm using Eclipse as an
I've written a very simple program that is meant to covert a char to
I'm porting a relatively simple console program written for Unix to the Windows platform

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.