Home Answers Viewqa Java-Beginners Calling external process in Java

 
 


Deepak Kumar
Calling external process in Java
1 Answer(s)      2 years and 7 months 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
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 Pages:
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
Java process
Java process  How will you invoke any external process in Java
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
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
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
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
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
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
calling a java file in java
calling a java file in java  how to call a another java file in java
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
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 from JSP
Calling from JSP  how can we call a class file from JSP   Hi, Do you want to call a servlet or a Java Bean through JSP? Please clarify this. For more information, visit the following link: JSP Tutorials Thanks
calling function - JSP-Servlet
calling function  Hai, How to call a java file in jsp file?  Hi friend, Step to be remember for solving the problem... Directive and import java file "Extends.java" package roseindia; public
Calling servlet from servlet .
Calling servlet from servlet .  How to call a servlet from another servlet in Java?   You can call another servlet by using... ServletException, IOException { System.out.println("Calling another servlet by using
Flex External Style sheet uses
; </mx:Application>  This is the process to use External Style sheet...Flex Style with External Style Sheet:- In this tutorial you can see how to use External Style Sheet inn your flex application. Firstly we have create Style
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 Constructor in Spring
Calling Constructor in Spring       In the given example you will be learning about a constructor... and retrieving the values defined in the constructor using java file.    
Server calling of .exe file in the client
Server calling of .exe file in the client   I have a requirement with java webapplication. We are using jboss as appserver on Linux machine. How can I call a .exe file from client machine? I want to run .exe from webpage like
calling zipping function - JSP-Servlet
calling zipping function  Hi, Is it possible to zip a jsp file. I wrote a java function for zipping a file.How to call that java file (zipping function ) in JSP ? pls help me Thanks.... 
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
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
set a class path - Development process
to ToolBar. Go to Project>>Properties>>Java Build Path>>Add External Jars>>ok This will add your jar file into Referenced Libraries
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
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
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
calling a session bean bean from servlet using netbeans - EJB
calling a session bean from servlet using netbeans  How to call a session bean from servlet using netbeans in Java
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
Methods - Calling
Java Notes Methods - Calling... to the caller. Calling a method When you call a method... to make it clear that you are calling the method with the current object. [needs
Java - looking for a tool to force-kill a child process (Windows)
Java - looking for a tool to force-kill a child process (Windows)  ... a child process that will simply not react to the standard Java way... tried closing the child process' error input and output stream before calling
calling one jsp from another jsp - JSP-Servlet
is just like calling a method() in the java/c++/c classes. It will call the method...calling one jsp from another jsp  Hi All, In my web application I have two jsp files(one.jsp and two.jsp). I have written a seperate method
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
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
deploy stand alone java project in JBoss - Development process
deploy stand alone java project in JBoss  i hv a stand alone java project nad a web project to be run on Jboss. from the web project i am calling the classes in stand alone java project. but i dont know how to deploy the stand
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
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
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
java - Development process
Java Sort String Array  How to sort string array in Java
Process Flows Output - Java Beginners
Process Flows Output  Hi, I have been asked to get a particular structure as the output. the assignment is as follows Any process flow has..... there might be a split activity sumwhere in the process, that splits the process flow
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 Steps - Development process
Java Steps  what are the steps to be taken to create a mobile phone compatible java swing program
java server - Development process
java server  Develop multi-threaded echo server and a corresponding GUI client in java
java with linux - Development process
java with linux  HI , This is namit.I want to know how to link a java program with linux platform
java reflection - Development process
java reflection  how to save and run reflection class in java?please immediately reply sir
java with alfresco - Development process
java with alfresco  how to write java code to upload different documents and search options using alfresco api
JAVA - Development process
StreamResult("data.xml"); initXML(); process(test...(); handler.startElement("","","Roseindia",atts); } public static void process (String s
java code - Development process
java code  to setup echo server and echo client.  Hi Friend, Please visit the following links: http://www.roseindia.net/java/network/ http://www.roseindia.net/java/example/java/net/udp/ Hope

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.