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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:10:53+00:00 2026-05-15T03:10:53+00:00

Process p; String line; String path; String[] params = new String [3]; params[0] =

  • 0
Process p;
String line;
String path;
String[] params = new String [3];

params[0] = "D:\\prog.exe";
params[1] = picA+".jpg";
params[2] = picB+".jpg";

try
{
    p = Runtime.getRuntime().exec(params);

    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));

    while ((line = input.readLine()) != null)
        System.out.println(line);

    input.close();
}
catch (IOException e)
{
    System.out.println(" procccess not read"+e);
}

I don’t get any error, just nothing. In cmd.exe prog.exe is working fine.

What to improve in order to make this code working?

  • 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-15T03:10:53+00:00Added an answer on May 15, 2026 at 3:10 am

    Perhaps you should use waitFor() to obtain the result code. This means that the dump of the standard output must be done in another thread:

    String path;
    String[] params = new String [3];
    
                        params[0] = "D:\\prog.exe";
            params[1] = picA+".jpg";
            params[2] = picB+".jpg";
    
            try {
                final Process p = Runtime.getRuntime().exec(params);
                Thread thread = new Thread() {
                    public void run() {
                        String line;
                        BufferedReader input =
                           new BufferedReader
                             (new InputStreamReader(p.getInputStream()));
    
                         while ((line = input.readLine()) != null)
                             System.out.println(line);
    
    
                         input.close();
                   } catch (IOException e) {System.out.println(" procccess not read"+e);}
                };
                thread.start();
                int result = p.waitFor();
                thread.join();
                if (result != 0) {
                    System.out.println("Process failed with status: " + result);
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 510k
  • Answers 510k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just try parent.functionName() it should work. Edit Just to be… May 16, 2026 at 5:05 pm
  • Editorial Team
    Editorial Team added an answer Ctrl + Space or Ctrl + J You can also… May 16, 2026 at 5:05 pm
  • Editorial Team
    Editorial Team added an answer Thanks for the replies, i have managed to see the… May 16, 2026 at 5:05 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have an execute(String cmd) in a jsp script that calls the exec method
I'm trying to execute a new process and read from its input stream in
I'm trying to use cmd.exe to search for a file in a specific directory
I am trying to edit a line of a text file (.Hex file) containing
I am trying to process various texts by regex and NLTK of python -which
I'm writing a python3 program, that gets the names of files to process from
Hi there I'm reading a string and breaking each word and sorting it into
I have a page where a user can import data to the site. either
When I upload the image it is showing this error please can u help
Under my project, I have a Java class file, inside of which I have

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.