Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Intermediate
Mar 6, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Starting an Executable File From Your Application

You can use this simple code to start any executable application or any executable files. Suppose you want to start the netscape.exe in your application. You can easily do this by setting String s equal to the path. For example, if the path is "C:\program Files\Netscape\Communicator\Program\netscape.exe" you can set String s equal to it and execute the application.
import java.lang.System;
import java.lang.Runtime;
public class play
    public static void main(String args[]) throws Exception
        Runtime r = Runtime.getRuntime();program\
         String s = "c:\program
If you want to use the finger command to get the names of those who have logged in, you can place "finger" in String s and execute the application.

Also, suppose you want to print a file named test.txt located in drive "C:" on a HP machine connected to the System named vinoth. The code would look like this:

s[] =
Rajasekaran Vinoth
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date