File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Running Programs from JAVA Programs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Running Programs from JAVA Programs" Watch "Running Programs from JAVA Programs" New topic

Running Programs from JAVA Programs

Parth Sagdeo
Ranch Hand

Joined: Mar 18, 2004
Posts: 40
Hi all,
How would one run another program from a JAVA program. For example, how would one code a program open a web browser or compile another JAVA file?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The short answer to this question is that you use the command:


However there are some pitfalls and things to be aware of in running this. Here's a link to an article that explains some of them:

Good Luck.


Consultant, Sima Solutions
Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
If you want to compile the other classes at runtime, see Compiler class in Java API.
I agree. Here's the link:
subject: Running Programs from JAVA Programs
It's not a secret anymore!