Run an .exe from java

i want to run an exe file. can any one tell me which command i should give 2 it
thanks in advance

You need to use java.lang.Runtime.exec(). Read the javadoc very thoroughly and search these forums for more information. This question has been answered very frequently here.

Similar Messages

  • How to run geniatagger.exe from java

    Hi,
    i'm trying to run geniatagger-1.0.exe from java on windows vista, using Process pr = Runtime.getRuntime().exec("C:/geniatagger-1.0/geniatagger-1.0.exe");
    However, i keep on getting the same error. "Cannot run *.exe CreateProcess error=2" . I tried the same code with excel.exe which is installed in C:/ProgramFiles
    and it worked. I also tried to create a path variable C:/geniatagger-1.0/geniatagger.exe;%path% and then run the same java code. Yet, nothing has changed.
    I would really apreciate any help

    dalab wrote:
    Sorry, i didn't realise that the link was already sent! I found that earlier as well. I"I..." what?
    "I ...figured it out"?
    "I ... still need help"?
    You're not a vampire named Trever are you?

  • Run EXE from JAVA program

    Does somebody know whether it is possible to run some program with extension EXE from JAVA program?

    Yes sombody knows. Yes it's possible. Have a look at Runtime#exec.

  • Starting IExporer.exe from java with J9 in an IPAQ

    Hi all,
    I'm trying to run IExplorer.exe from a java program in a IPAQ with j9 cvm.
    I did try it in Windows 2000 and it works fine but when running it in the IPAQ with Windows CE it throws an exception.
    Looks like the Exception is thrown because it can not find the file, but I think I'm writing the correct path and file name.
    Here is the code and the exception. Can any one try it and tell me what Am I doing wrong.
    Thanks a lot.
    String s = "\\Windows\\iexplore.exe";
    //String s = "\"C:\\Program Files\\Internet Explorer\\IEXPLORExx.EXE\"";
    try
    System.out.println("s: " + s);
    Runtime runtime = Runtime.getRuntime();
    Process p = runtime.exec(s);
    catch(IOException ioEx)
    ioEx.printStackTrace();
    java.io.IOException: Unable to start program
    Stack trace:
    com/ibm/oti/lang/SystemProcess.create([Ljava/lang/String;[Ljava/lang/String;L
    java/io/File;)Ljava/lang/Process;
    java/lang/Runtime.exec([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)L
    java/lang/Process;
    java/lang/Runtime.exec(Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Lj
    ava/lang/Process;
    java/lang/Runtime.exec(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Proce
    ss;
    java/lang/Runtime.exec(Ljava/lang/String;)Ljava/lang/Process;
    com/gestorPosicion/inicio/InicioCliente.main([Ljava/lang/String;)V                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The problem is that on PocketPC you cannot redirect input or output and the exec() call will not work as expected so it instead throws the exception to indicate this doesn't work on PocketPC.

  • How to terminate an exe from Java

    Hi Everyone
    Can anyone let me know the code to how to terminate an exe from Java
    I run an exe using
    Runtime.getRuntime().exec(dialog); //where dialog is a string (pointing to an exe)
    Now i need to kill this exe
    How do i do this in java
    Any help is highly appreciated
    Thanks!

    getafix14 wrote:
    I run an exe using Runtime.getRuntime().exec(dialog); //where dialog is a string (pointing to an exe)
    Now i need to kill this exe
    How do i do this in java
    ejp wrote:
    Process.destroy();
    And don't forget to take a swig of magic potion first.
    Winston

  • How to run Other application from Java

    I want to run other applications such as IE.exe, notepad.exe from Java? How can I run?

    Dear Friend, the following is the code to open IExplorer from Java Program
    class RunTimeTest {
    public static void main(String args[]) {
    try {
    Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.exe");
    catch(Exception e) {
    [\code]
    ALL THE BEST
    Shiva                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Running ls command from Java stroed procedure no output

    Hi ,
    I am trying to run ls command from java stored procedure in oracle
    Process p = Runtime.getRuntime().exec("ls");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("output of the command run:\n");
    while ((s = stdInput.readLine()) != null) {
    System.out.println(s);
    from java stored procedure in oracle.
    i get output of println statments but it does not go into while loop to print from stdInput.
    Result of running Java stored procedure is -
    output of the command run:
    Call completed.
    when i run the program on client side it works fine.
    Has anybody tried this from java stroed procedure.
    Thanks,
    Jag

    Jag,
    Actually, the question of whether it works for me seems to depend on the version of the OS (or Oracle). On RedHat Linux (Oracle 8.1.6) it didn't work at all, but on Solaris (Oracle 9.0.2) it did. Here's the output from that run:
    SQL> /
    output of the command run:
    init.ora
    initDBPart9i.DBPSun01.ora
    initdw.ora
    lkDBPART9I
    orapw
    orapwDBPart9i
    spfileDBPart9i.ora
    Done
    PL/SQL procedure successfully completed.
    But, I did need to change a line of your code to this:
    Process p = Runtime.getRuntime().exec("/usr/bin/ls");
    your original was:
    Process p = Runtime.getRuntime().exec("ls");
    You might consider, if possible, use of some of the Java File classes instead of ls, as this might make things more predictable for you. There were some examples in oramag.com a few months ago, but they were pretty simple (you might not need them).
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

  • Request to run updater.exe from an unknown publisher starting firefox

    every time Firefox is started from initial turn on of computer (not from the computer being hibernated or in sleep mode), I receive a message to run Updater.exe from an Unknown Publisher. There is nothing to show that this is a Firefox application but, I am not receiving any threat messages either. Is there any way to find out where this Updater is coming from and if it is to be trusted?

    Do you use a Norton security suite? If so, I suggest checking with Norton's support on whether that prompt is legitimate.
    You will find numerous unofficial distributors advertising on Google for Firefox downloads. These generally are bundles of crap along with Firefox. You should check to make sure you don't have such a thing installed.
    Open the Windows '''Control Panel''', Uninstall a Program. After the list loads, click the "Installed on" column heading to group the infections, I mean, additions, by date. This can help surface undisclosed bundle items that snuck in with some software you agreed to install. Take out as much trash as possible here.
    You can supplement your regular security software with the '''scanning/cleaning tools''' listed in our support article: [[Troubleshoot Firefox issues caused by malware]]. These on-demand scanners are free and take considerable time to run. If they finish quickly and especially if they require payment, you may have a serious infection. I suggest the specialized forums listed in the article in that case.
    Does that help?

  • Running  .nsi file from java

    hi,
    Ho to run .nsi file from java.
    thanks in advance.

    User845466 wrote:
    Ho to run .nsi file from java.Find the program hanling that kind of documents an launch this via Runtime.exec() giving it your *.nsi file as a parameter.
    bye
    TPD

  • I cannot uninstall Firefox, either through Control Panel Add/Remove or by running helper.exe from Program Files.

    Nothing happens when I click on REMOVE for Mozilla Firefox from the Add/Remove screen of Control Panel. I then tried to run helper.exe from the Mozilla Firefox folder in Program Files, but that wouldn't run either. Any suggestions?
    == This happened ==
    Just once or twice
    == When I tried to uninstall Firefox

    unistalled foxtab, however the window saying "want to add this pers. button to toolbar" no matter what I do I can't get it off , close firefox, remove or delete or get a new firefox download to replace it in the harddrive etc. Its locked up firefox and I have to use safari to access the web. how do I get this circular message etc. off ?

  • Call c++ program .exe from java

    Hello every body
    i have a problem while calling Hello.exe from java
    c++ code
    #include "stdafx.h"
    #include <iostream>
    # include <string>
    using namespace std;
    int main(int argc, char *argv[])
         int x;
         cout<<"Just test ";
    return 0;
    }java code:
    import java.io.IOException;
    public class runtime{
        public static void main(String[] args){
        try
        Process process = Runtime.getRuntime().exec("Hello.exe");
        }catch (IOException e)
         e.printStackTrace();
    }it display nothing!!

    alexxzius wrote:
    String line="";
    BufferedReader input =
    new BufferedReader
    (new InputStreamReader(process.getInputStream()));
    while ((line = input.readLine()) != null) {
    System.out.println(line);
    There is a danger of deadlock in this code. The OP should read the 4 sections of [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] and implement ALL the recommendations.

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Calling C code (exe ) from Java program

    Hi all,
    kindly help in giving a solution for calling C code (exe ) from Java program, i will be very thank full to u if any body can help in sending a code example
    bye

    You might need to consume the io operations on the Process...
    An excerpt from java.lang.Process:
    All its standard io (i.e. stdin, stdout, stderr) operations will be redirected to the parent process through three streams (Process.getOutputStream(), Process.getInputStream(), Process.getErrorStream()). The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.

  • Running an exe from within Oracle WebLogic 10g R3 does not find dll

    Hi,
    I am facing a strange issue with Oracle WebLogic 10g R3.
    I use the code as shown in Listing 1 below to run a windows based application exe (batch job) from within my web application hosted on Oracle WebLogic 10g Release 3.
    Note that this code woks fine on Tomcat 6.x and OC4J (JDeveloper TP4).
    The exec gets executed but the log of the exe program shows it could not load certain DLLs.
    Note that these DLLs are in the same directoy as the Batch program and this directory is in the PATH.
    Running through simple Java Program Successful*
    When I run the same program from a java program it runs successfully. So this means some WebLogic environment does not get set properly.
    Running directly BatchProg.exe rather than cmd.exe fails*
    Also note that when I run the exe directly e.g. BatchProg.exe rather than through cmd.exe it gives me a error the system did not find the file specified.
    CreateProcess error=2, The system cannot find the file specified with cause java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    Listing 1:*
    String[] commandArgs = new String[|http://forums.oracle.com/forums/] { "cmd.exe", "/C", "BatchProg.exe \"param1\" \"param2\" " },null , l_workingDir)
    Runtime rt = Runtime.getRuntime();
    Process proc;
    proc = rt.exec( commandArgs, envParams, workingDir );
    ProcessIO errStream = new ProcessIO( proc.getErrorStream(), "ERROR");
    ProcessIO outStream = new ProcessIO( proc.getInputStream(), "OUTPUT");
    errStream.start(); // process any errors from the command
    outStream.start(); // process any output from the command
    System.out.println("Error=" +errStream);
    System.out.println("Out" + outStream);
    return (p_waitToFinish ? proc.waitFor() : this.SUCCESS);

    OK.
    I have posted this on the WebLogic Forum.
    Thanx.

  • Running shell command from Java, but from Windows Schedule Task?

    I have a simple java program that will start a dos based program. The java program works great when I run it, but when I run it from the Windows Task Scheduler, the dox box that should pop up, does not. It is running because I can see it in the task manager but I can not see the command window.
    Any ideas how to show the command window from a java application that is ran from Windows Task Scheduler?
    Example program below. Runs fine by itself, should get a dos popup that issues the directory command, run it from the scheduler and it does not show the dos box. You can however see it in the Processes as CMD.exe.
    import java.io.IOException;
    public class Test {
          * @param args
         public static void main(String[] args) {
              try {
                   Runtime.getRuntime().exec("cmd /k start dir");
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Now the my real program is quite a bit more complicated. It actually goes out and checks the status of an Oracle Database, if all the tablespaces are online, then the middle tier application is allowed to start. The middle tier application is started by my java application, and is comes up with a dos console which shows status and users connected to the database.

    Jag,
    Actually, the question of whether it works for me seems to depend on the version of the OS (or Oracle). On RedHat Linux (Oracle 8.1.6) it didn't work at all, but on Solaris (Oracle 9.0.2) it did. Here's the output from that run:
    SQL> /
    output of the command run:
    init.ora
    initDBPart9i.DBPSun01.ora
    initdw.ora
    lkDBPART9I
    orapw
    orapwDBPart9i
    spfileDBPart9i.ora
    Done
    PL/SQL procedure successfully completed.
    But, I did need to change a line of your code to this:
    Process p = Runtime.getRuntime().exec("/usr/bin/ls");
    your original was:
    Process p = Runtime.getRuntime().exec("ls");
    You might consider, if possible, use of some of the Java File classes instead of ls, as this might make things more predictable for you. There were some examples in oramag.com a few months ago, but they were pretty simple (you might not need them).
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

Maybe you are looking for

  • 1st Generation iPod Touch Problems: First freezes, then no music

    Hi, I was wondering if anyone else have had this problem. My first generation iPod touch's screen stops working, but is responsive and the button and works, but since I need to slide it, I wasn't able to use it. When I plugged in my headphones, it fr

  • Correct connection of an external hard drive to a Time Capsule

    I received a 500GB Time Capsule and 1 TB Western Digital "My Book" Essential external hard drive for my birthday. My current wireless system consist of a Airport Extreme with a Maxtor 250GB external hard drive and usb printer connected to the Airport

  • Where upload file is store through FileUpload UI at server ?

    Hi, Where upload file is store through FileUpload UI ? And How i access that server location ? Regards, Gurprit Bhatia Edited by: GURPRIT BHATIA on Jun 5, 2008 2:49 PM

  • Can I burn free video podcasts to DVD?

    I'm trying to burn free video yoga podcasts to a DVD so I can play it in my DVD player. Can I do this? I'm testing it out now, but it's taking hours to "Process Movies," encoding first the video and then the audio. I'm only working with about an hour

  • My iphone 6 suddenly wont connect to wifi unless right next to it

    iPhone 6 running ios 8.2 suddenly wont connect to my wifi unless extremely close. it is not the wifi as all other devices including an iPad 4th gen, macbook pro 13 inch and iPhone 4s have full bars from the room i am in, sometimes the iPhone 6 will g