Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

start another program from an application

Posted on 2006-11-03
Last Modified: 2010-03-31
Hi Experts,

A simple question...

I have developed an application and from that application I have to start another application that is on my hard disk.
Is there a way to start that outside application from my application.

Question by:blarouche
  • 3
  • 2

Assisted Solution

gkishoreji earned 50 total points
ID: 17868632
u can use Runtime.exec to execute that application

Author Comment

ID: 17868767
The file I have to start is in my F:\ua\EzDownloader.exe

How would I code that?

LVL 14

Accepted Solution

hoomanv earned 75 total points
ID: 17868811
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 17868900

I get the following messasge when I run the code :

java.lang.IllegalThreadStateException: process has not exited
      at java.lang.ProcessImpl.exitValue(Native Method)
      at alarms.Test.main(Test.java:13)

I have to say that when I  excecute EzDownloader,  another message box appears and ask me to push on the button Download now.

Author Comment

ID: 17868910
I forgot to include my code :

import java.util.*;
import java.io.*;

public class Test
    public static void main(String args[])
            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec("F:/ua/EzDownloader");
            int exitVal = proc.exitValue();
            System.out.println("Process exitValue: " + exitVal);
        } catch (Throwable t)
LVL 14

Assisted Solution

hoomanv earned 75 total points
ID: 17868939
exitValue() throws IllegalThreadStateException - if the subprocess represented by this Process object has not yet terminated.

You can use waitFor to wait for the process to terminate

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
netstat -ano | find "8000" and taskkill /f /pid 2984 3 83
oracle 11g 23 107
mysql jsp example issue 32 48
sql import cannot be resolved jsp 3 47
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question