Running a windows application from Java App

Posted on 2001-06-06
Last Modified: 2010-03-31

I'm messing about with Swing for the first time and I'd like to create a Desktop toolbar.  How can I tie a button to a Command String like "C:\Notepad.exe" ??  Don't worry about the button side of the code ... I'd just like to find out how I can get a Java app to invoke such a call on the Operating System.

Any ideas are warmly welcomed !!

Question by:robertod031297
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
LVL 92

Expert Comment

ID: 6158868

LVL 92

Accepted Solution

objects earned 200 total points
ID: 6158873
It returns a Process object which can then use to do such things as:
- check on the process status
- get input/output stream
- kill it

Pls refer to the javadoc :)

Let me know if you need any more info.


Author Comment

ID: 6158925
That's just what I was after ...
Thanks Objects (??interesting name??),

Expert Comment

ID: 6159413
public class AppRunner {
     public static void main(String[] args) {
          String app = "notepad";
    try {
         Process process = Runtime.getRuntime().exec(app);
    } catch(Exception e) {}
LVL 92

Expert Comment

ID: 6161904
> Thanks Objects (??interesting name??),

Company name,

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Way to decrease size of apk file 9 108
jdbc error in jsp application 20 73
Opening PDF on button click and fill new document 2 54
Setup GlassFish 4 35
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 …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

749 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