Running an exe file from jsp

Hi,
Do you know a way to run the "startup.exe" Tomcat file from jsp?
I have to start and stop a server remotely.
Max

public Process pFiglio;
Runtime rt = Runtime.getRuntime();
pFiglio = rt.exec("c:\\Tomcat\\startup.exe ");
then you can have
pFiglio.waitFor();
iEsito = pFiglio.exitValue();
pFiglio.destroy();
Look at specification:
http://java.sun.com/j2se/1.5.0/docs/api/
Look class "Runtime" and "Process".
Ema

Similar Messages

  • Running an exe file from java

    Hi , can anyone tell me how to run an exe file from my java program. the exe is in the same directory as my java files . When i click on a button i want to put something in the actionPerformed() method which will launch the exe file - prog.exe
    Hope someone can help me.
    Thanks Jim

    Hi !
    Look at the RunTime class...

  • How do I run an exe file from a java program?

    I need to run an exe program from within a java program.
    what do I need to do this?
    thanks

    See java.lang.Runtime.exec()

  • Unable to run an exe file from a Servlet

    I am not able to run a Servlet that calls an exe file using the following code. trial.exe is was built from a C program and it is simply a program that creates a text file with some content. I am using Tomcat 6.0 and JDK 1.5 on a Windows XP.
    {color:#000080}try
    Runtime rt=Runtime.getRuntime();
    String[] command = {"C://Tomcat 6.0//webapps//ROOT//WEB-INF//classes//trial.exe"};
    {color}
    {color:#000080}
    Process p = Runtime.getRuntime().exec(command);
    p.waitFor();
    catch(Throwable t)
    // System.out.print(t.getMessage());
    }{color}
    Before running the code on Tomcat I've compiled the code above in a simple java programe and it executed without any problem.
    Then I compiled the code within a servlet. No luck. Then I treid the following options:
    Executed the Tomcat service under the context of a user by specifying a user(Log On option) for the Tomcat service.
    Then with Local System Account, selecting “Allow service to interact with desktop”.
    this time also, no luck. Can somebody help me on this please ?
    BJJ

    For clarity I am rewriting the last sentences here:
    Then I compiled the above code within a servlet successfully and invoked the servlet from a browser with and without the following settings of Tomcat 6.0.
    1. Executed the Tomcat service under the context of a user by specifying a user (Log On option) for the Tomcat service.
    2. Then with Local System Account, selecting �Allow service to interact with desktop�.
    I was not succeeded with any of the methods mentioned above.

  • Run a .exe file with parameters from my java code

    Hi, I want to run a .exe file from my java program. This .exe file will take some parameters in the command line. I need
    to supply that to the program as well. Can someone help me in this please?
    Thanks in advance.

    I am trying like this:
    public class lauch_ext {
         public static void main(String[] args) throws Exception{
              try {
                Runtime rt = Runtime.getRuntime();
                Process pr = rt.exec("C:\\Apps\\myapp.exe arg1 -arg2 return_arg");
                BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
                String line=null;
                while((line=input.readLine()) != null) {
                    System.out.println(line);
                int exitVal = pr.waitFor();
                System.out.println("Exited with error code "+exitVal);
            } catch(Exception e) {
                System.out.println(e.toString());
                e.printStackTrace();
    }

  • How to run exe file from inside java

    I wan to run an exe file from inside java code. How can I do it?
    Thanks

    Hi Oakam
    This is very simple. Just go through the given code below
    in place of FILEANDPATHNAME just give the exe's path and name
    Note :- adding ".exe " is not necessary
    public class exep
    public static void main(String args[])
    Runtime r = Runtime.getRuntime();
    Process p = null;
    try{
    p = r.exec("FILEANDPATHNAME");
    catch(Exception e)
    Give ur feedback
    Thanx
    Ottran

  • .exe file from java

    Hi all !!!
    Is it possible to run a *.exe file from java.....
    if yes how??
    if no why not??
    regards
    ad

    Yes. It's possible. One of the Runtime.exec() methods are probably what you want:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    You can't instantiate a Runtime object, so you'll need to call it up by:
    Runtime.getRuntime()
    For example, if you want to run the Calculator in Windows, try:
    Runtime.getRuntime().exec("calc");

  • How to run an external .exe file from an indesign pluging

    Hi,
          Suppose if I have written an separate application in C++ (.exe file) & need to run it from an indesign pluging(as if a service in windows). have you provided that facilities in your SDK? if it's please let me know how to run an external .exe file from a indesign pluging.
    Thanks,

    I'm actully writing data in PMString to a external txt file.
    another question..
    if i want to execute an action when the ok button is cliked how can i do it?
    whe i add a button(widget) i know how to handle it. please see my code.
    // Call the base class Update function so that default behavior will still occur (OK and Cancel buttons, etc.).
    CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
    do
    InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
    ASSERT(controlView);
    if(!controlView) {
    break;
    // Get the button ID from the view.
    WidgetID theSelectedWidget = controlView->GetWidgetID();
    if (theChange == kTrueStateMessage)
    //if (theSelectedWidget == kEXTCODGoButtonWidgetID
    switch(theSelectedWidget.Get())
             case kEXTCODGoButtonWidgetID:
      this->ViewOutput();
      break;
             case kEXTCODFindButtonWidgetID:
      this->SaveLog();
      break;
    // TODO: process this
    } while (kFalse);
    I do two actions "SaveLog" & "ViewOutput()" using two buttons. But i dont know how to execute an action when the ok button is clicked...

  • Running .EXE file from Java

    Do you know, how run an .exe file, for example Internet Explorer or other program, from Java application?
    It's very important for me.

    Too run external program and pass string arguments see class java doc
    of java.lang.Runtime method exec . You see online or download or
    rename src.jar to s.zip EXTRACT and see
    exec
    public Process exec(String[] cmdarray,
    String[] envp)
    throws IOException
    Executes the specified command and arguments in a separate process with the
    specified environment.
    This is a convenience method. An invocation of the form exec(cmdarray, envp)
    behaves in exactly the same way as the invocation exec(cmdarray, envp,
    null).
    Parameters:
    cmdarray - array containing the command to call and its arguments.
    envp - array of strings, each element of which has environment variable
    settings in the format name=value, or null if the subprocess should inherit
    the environment of the current process.
    Returns:
    A new Process object for managing the subprocess
    Throws:
    SecurityException - If a security manager exists and its checkExec method
    doesn't allow creation of the subprocess
    IOException - If an I/O error occurs
    NullPointerException - If cmdarray is null, or one of the elements of
    cmdarray is null, or one of the elements of envp is null
    IndexOutOfBoundsException - If cmdarray is an empty array (has length 0)
    See Also:
    ProcessBuilder
    getRuntime
    public static Runtime getRuntime()
    Returns the runtime object associated with the current Java application.
    Most of the methods of class Runtime are instance methods and must be
    invoked with respect to the current runtime object.
    Returns:
    the Runtime object associated with the current Java application.

  • How to run .EXE files from Linux Portal page?

    We have an IIS web server that runs a Photoshow_player.exe slide show program. I'm not sure if this can run from Linux Portal, but we are trying.
    The link in an IIS web page looks like this:
    <a> href="file:///\\mulsrv22\share\PCS\PhotoshowPlayer.exe" title="clean slate">clean slate</a>
    Portal is installed and running from two Linux servers. If I create a link using the above syntax, I get "can not display page" browser errors.
    I copied the entire PCS directory from the Windoz box to a Portal web_dav folder, but running the .EXE link from that Portal page gives errors indicating that the /PDS/data/.XML and /PCS/data/.jpg files can not be found.
    Any ideas on how I can run this slide show from Linux Portal?
    Thanks.
    --Don                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    if you just need to run a slideshow in you portal, why don't you use a javascript slide show ?
    Just "googleize" and you'll find tons of javascripts taht can do that.
    for example : http://www.barelyfitz.com/projects/slideshow/

  • Run EXE File from Developer

    hi all
    i am looking for code to run a program(any EXE File ) from developer Form (Developer 6i)
    thanks a lot

    look at the documentation for the HOST command in Forms.
    Regards
    Grant Ronald
    Forms Product Management

  • Running exe files from java applications

    Hello All,
    Is it possible to run executable files from java applications?
    I need to run an exe file on the client from the server machine, the exe could reside on either the server or any other machine on the LAN. Is it possible to specify the path of where the exe resides, and run it on a client machine?

    HI,
    I tried to launch a MS Word application using runtime.exec but it gives me some problem
    The foll. code to launch a txt file using notepad works.
    Runtime rt = Runtime.getRuntime();
    String[] callAndArgs = {"notepad.exe","C:\\coo7\\wizard.txt"};
    Process child = rt.exec(callAndArgs);
    However, oif I try to launch a MS Word application, it asks for the entire path of WINWORD.exe, (unlike just specifying notepad.exe as the first argument in String[] callAndArgs) and this can vary from one machine to another.. how do I get around this?
    The foll. code snippet works but the complete path of where WINWORD.exe might be installed on any machine, is not fixed:-(
    Runtime rt = Runtime.getRuntime();
    String[] callAndArgs = {"C:\\Program Files\\Office\\Office10\\WINWORD.exe","C:\\coo7\\wizard.doc"};
    Process child = rt.exec(callAndArgs);
    Any idea/suggestions pls..

  • Launch EXE file from IC WebClient

    Hi All,
    How can we call .exe file from IC WebClient.
    we want to launch the .exe file from the navigation into application work area.
    any suggestion would be great.
    Thanks,
    Raj.

    Hello Raj,
    The best way to do this would be with the Transaction Launcher. Depending on the version of CRM you are running, you might need to modify the handler class -- as some newer version of CRM seemed to append the http preface to the front of any non-URL file name. Of course, if your EXE program runs as a web application, you could just call the URL.
    Best regards,
    John

  • Can I run a .exe file on a Mac?

    I need to know know if it's possible to run a '.exe' file on an Intel-based Mac running Mac OS X. There's a CD with an application I need to run. In the Finder it has the icon of the black computer screen with green letters and it's titled 'startCD.exe. It'll run on Windows but due to circumstances I need to run it on my computer. Any direction you can point me in will be greatly appreciated. Thank You!
    MacBook   Mac OS X (10.4.8)  

    Maybe:
    http://www.codeweavers.com/
    "CrossOver Mac allows you to install many popular Windows applications and games on your Intel OS X Mac. CrossOver includes an easy to use, single click interface, which makes installing Windows software simple and fast. Once installed, your application integrates seamlessly in OS X. Just click and run your application directly from the OS X Finder. Clicking a Windows file or document — including email attachments — will launch the appropriate Windows program, allowing you to work on the files. Best of all, you do it all easily and affordably, without needing a Microsoft operating system license.
    Adding new Windows software is easy. Just place your install CD in your Intel Mac, and CrossOver will recognize it and offer to begin the installation process. CrossOver then completes the installation and configures your application to run on your Mac. That's all there is to it."

  • Is it possible to convert Java to EXE and run this EXE file without any JRE

    hello friends
    I have GCC/GCJ for windows but dont know how to work with it... it creates file with .o extension but i m not able to create .exe from that... i installed mingw for that also .. unsuccessful ...
    tell me the solution for it... i want to generate machine dependent exe from java file...on the web i ve seen that GCC/GCJ is used on linux platform..not cleared properly..
    Again i m writing my question
    Is it possible to convert Java to EXE and run this EXE file without any JRE if yes then how... tell me the procedure to do that...

    Vipul wrote:
    Its software now hardware .... some times u need these things ...anyway do u ve solution for my questionSo what? By creating a native executable you are restricting the program to the OS for which that native executable was made, just like removing the engine from a car restricts driving to downhill only. So like the I said, the principle remains the same, "Why would you want to?"
    I am asking you, truthfully, why do you feel the need to negate the largest advantage of using Java by creating a native executable from it?
    What is your rationale?
    I can pretty much guarantee there is a much better way of achieving your wish without "removing the engine".

Maybe you are looking for

  • Billing Document _ Accounting Document not created

    Dear SD Experts, While creating billing document, the accounting document was not created.  So, the debit entry in customer account was not made. But the Excise Invoice was created with reference to this billing document. Modvat was also utilized. Th

  • Terms and conditions in a new page in PO pdf

    Hi, I have set the profile values for PO:Terms and conditions and PO:In file path to my text file. I was expecting the terms in a new page but it was showing it after the Line information in the last page instead of starting a new page. Any idea on h

  • Select cursor reference XY Graph

    Question... I have a XY graph. This graph has 3 cursors. Now I want to be able to select cursor 1, 2 or 3. And then edit some property nodes, like line style, width, color. How do I do this? Because I can only get 1 cursor reference... that of the ac

  • Iphone 2G 3.1.3 Can't download apps from App store??

    Hi. I have an Iphone 2g on I.O.S 3.1.3 . For some reason, I cant download any apps in the app store. The link comes up to install but the graphic on the button is partially missing and when i touch it, it just changes colour and wont download. Plz he

  • Lightroom 5 stops working after trying to email photos within LR and using Outlook 2013

    I recently upgraded to Lightroom 5 and was tryinhg to email some photo via the Lightoom Send Email dialog.  My default email is Outlook 2013 and I am using Windows 7 64bit.  When the dialog is filled and send email is selected LR 5  says "Lightroom h