Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Calling external process in Java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Deepak Kumar
Calling external process in Java
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners


Hi,

How I can call some system command from Java? I want to run the Microsoft Calculator application from Java, how it can be done. Provide me example.

What is the use of Runtime.getRuntime().exec(?.) command.

Thanks

Advertisement
View Answers

September 8, 2012 at 3:23 PM


In a very general way:

try {

     String[] cmds = {path+"/*.exe"};
     Process proc = Runtime.getRuntime().exec(cmds);
} catch (Exception e) {

     e.printStackTrace();
}

for your question:

try {

     Process proc = Runtime.getRuntime().exec("calc.exe");
} catch (Exception e) {

     e.printStackTrace();
}


Related Tutorials/Questions & Answers:
Calling external process in Java - Java Beginners
Calling external process in Java  Hi, How I can call some system command from Java? I want to run the Microsoft Calculator application from Java, how it can be done. Provide me example. What is the use of Runtime.getRuntime
calling a java file in java
calling a java file in java  how to call a another java file in java
Advertisements
javac is not ecognised as internal and external command - Java Beginners
javac is not ecognised as internal and external command  i have... is not recognised as internal and external command.please reply me as soon as possible  Hi Friend, It seems that either java is not installed
Java process
Java process  How will you invoke any external process in Java
calling method - Java Beginners
calling method   class A{ public void fo(){ class B{ public void fo1(){ System.out.println("fo1 of class B"); } } System.out.println("fo of class A"); } class C{ public void fo2
calling java beans - JSP-Servlet
calling java beans  Sir, I want to know where to place the java beans java file and class file inside tomcat web server. and how to call them from jsp file.  Hi Friend, Java Bean is placed in classes\form
Calling exe through Java program. - Java Beginners
Calling exe through Java program.  Hi, How to call a vb exe that takes one argument , using a Java program. Thank You, Umesh Kilkile ... IOException{ Runtime r=Runtime.getRuntime(); Process p=null; try { String s="C
Calling java class method from javascript
Calling java class method from javascript  I want to call a java class method from javascript. The java class method is like "public String[] getWord()". I want to assign this string array value to a variable in javascript. I
send ACK to external device
send ACK to external device  i want to do connection with an external device that make medical tests to send to it a message but, this device should... to make that with java code
Process in Java
Process in Java  how can I execute a java program as a process which i can monitor it in the task manager to see the cpu usage
ipad external display tutorial
ipad external display tutorial  Hi, I am looking for a iPad external display tutorial. I have a VGA adapter but my application need to support it to show anything on external device. Please suggest me. Thanks
Read external file in PHP
Read external file in PHP  How to read external files in PHP in particular time duration and save that file with the latest date. How is it possible? Please explain with an example. Thanks
Implement Java clients calling Web Services
Implement Java clients calling Web... the enterprise components Next    Implement Java clients calling Web Services Generating a Java client proxy and a sample
External file reading in jsp
External file reading in jsp  i have written a jsp page(ReadExt.jsp) in my application which reads a text file content from a system... used java code in jsp page ... and tel me how can i make it work in other system
core java ,io operation,calling methods using switch cases
core java ,io operation,calling methods using switch cases  How to create a dictionary program,providing user inputs using io operations with switch cases and providing different options for searching,editing,storing meanings
Problem with external DTD - XML
Problem with external DTD  Hi, This class generate an XML file.But while I am running that generated xml file its giving error as can not locate...(); String[] lstr={"JAVA","NET WORKING"}; String[] lstr1={"SCJP","NET
video calling
video calling  how to implement video calling using java? i am a final year mca student please give me some samplecodes
video calling
video calling  how to implement video calling using java? i am a final year mca student please give me some samplecodes
External file reading in jsp
External file reading in jsp  i have written a jsp page(ReadExt.jsp) in my application which reads a text file content from a system .. but this ReadExt.jsp page is not working in other system when i open that application
ejb calling from jsf - Java Server Faces Questions
ejb calling from jsf  1st i take list of person then i try to edit...) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java
how to start intergrated webcam of a laptop without calling its exe file using java only - Java Beginners
how to start intergrated webcam of a laptop without calling its exe file using java only  how to open integrated webcam of a laptop without calling its exe file using java only?.simply what i am asking is that is there any method
Calling Destructor
Calling Destructor  How can i call destructor in java using System.gc() or manually. Please anyone give me a example program   Java... to the file."); } } Java Garbage Collection using System.gc
java code - Development process
java code  hi, this is sampath, how to acchive the batch processing in java or batch process base java thread. can u send the code and brief explanation. thanks and regards sampath reddy
Calling a function
Calling a function  Hi, I have a function xyz() in php code. When a button is clicked it should execute that particular function for that i have written as <form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
process of compiling and running java program
process of compiling and running java program  Explain the process of compiling and running java program. Also Explain type casting
Thread and Process - Java Beginners
, VijayaBabu.M  Hi vijayaBabu A process can contain multiple threads. In most multithreading operating systems, a process gets its own memory address... process. For instance, a JVM runs in a single process in the host O/S. Threads
core java - Development process
. The process is known instantiation For example : class... to : http://www.roseindia.net/java/master-java/java-object-oriented-language.shtml
Velocity with External Properties
Velocity with External Properties   ... with External Properties. The method used in this example are described below..." is a external system property.      
java - Development process
Java Sort String Array  How to sort string array in Java
java - Development process
java  hi, can u send an example code in MVC Architecture for gym process i just want to get register id from database for citizen .then he will add is suggestion in text box and submit it i am sending jsp page u will get idea
JAVA - Development process
StreamResult("data.xml"); initXML(); process(test...(); handler.startElement("","","Roseindia",atts); } public static void process (String s
 

 

 

DMCA.com