Solved

start another program from an application

Posted on 2006-11-03
6
222 Views
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.



Thanks
0
Comment
Question by:blarouche
[X]
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
  • 3
  • 2
6 Comments
 
LVL 5

Assisted Solution

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

Author Comment

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

How would I code that?


0
 
LVL 14

Accepted Solution

by:
hoomanv earned 75 total points
ID: 17868811
Runtime.getRuntime().exec("F:/ua/EzDownloader.exe");
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:blarouche
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.
0
 

Author Comment

by:blarouche
ID: 17868910
I forgot to include my code :

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


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

Assisted Solution

by:hoomanv
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
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

695 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