DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Using a button to execute an independant program

  1. #1
    Dave Guest

    Using a button to execute an independant program


    If I had a simple application with one button on it, what would be the proper
    code to make clicking the button open a particular program, such as Solitaire
    or Notepad?? Thanks for any help.

  2. #2
    Paul Clapham Guest

    Re: Using a button to execute an independant program

    I'll leave out the code to add the button, make a listener, etc. because you
    probably already know how to do that. The listener needs to do this line of
    code:

    Runtime.getRuntime().exec(yourProgram);

    where yourProgram is a String containing the name of the program you want to
    initiate. This should be the full path name of the program ("C:\Program
    Files\Whatever\AndSoOn\Thing.exe") unless it can be found using the PATH
    environment variable.

    PC2

    "Dave" <dsmisuraca@earthlink.net> wrote in message
    news:3acd20b7$1@news.devx.com...
    >
    > If I had a simple application with one button on it, what would be the

    proper
    > code to make clicking the button open a particular program, such as

    Solitaire
    > or Notepad?? Thanks for any help.




  3. #3
    Dave Misuraca Guest

    Re: Using a button to execute an independant program


    Paul...

    Thanks for the help. It's appreciated very much.

    Dave Misuraca


    "Paul Clapham" <pclapham@core-mark.com> wrote:
    >I'll leave out the code to add the button, make a listener, etc. because

    you
    >probably already know how to do that. The listener needs to do this line

    of
    >code:
    >
    >Runtime.getRuntime().exec(yourProgram);
    >
    >where yourProgram is a String containing the name of the program you want

    to
    >initiate. This should be the full path name of the program ("C:\Program
    >Files\Whatever\AndSoOn\Thing.exe") unless it can be found using the PATH
    >environment variable.
    >
    >PC2


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center