How to run .jar from ASP.NET application??

Discussion in 'Software' started by hpinninty, Sep 17, 2009.

  1. hpinninty

    hpinninty

    Joined:
    Sep 17, 2009
    Messages:
    1
    Hi

    Could anyone let me know what is wrong with the below code.
    It is not displaying any message.

    I have a button click event which runs .jar file from C#.NET application.
    //Button Click Event for running .jar file
    protected void btnRunJarApplication_Click(object sender, EventArgs e)
    {
    String strJarFilePath = "\\testHelloWorldNew.jar";

    Process proc = new Process();
    try
    {
    proc.StartInfo.FileName = "java";
    proc.StartInfo.Arguments = "-jar " + strJarFilePath;
    proc.StartInfo.CreateNoWindow = false;
    proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    proc.StartInfo.UseShellExecute = false;

    DirectoryInfo currentDir = new DirectoryInfo(Environment.CurrentDirectory);
    proc.StartInfo.WorkingDirectory = currentDir.FullName;

    proc.Start();
    //give Processor 5sec to close
    proc.WaitForExit(5000);
    }
    catch (Exception ex)
    {
    if (!proc.Start())
    throw new Exception("Failed to start process");

    }
    }


    I have the following questions:
    (1). testHelloWorldNew.jar file is displaying the "Welcome to HelloWorld!" from Command Prompt. How can i either capture this message or the status of the execution of .jar file??
    (2).How to make sure this process is executing correctly and closing?

    Can anybody throw some light on this?

    Thanks.
    Swetha
    hpinninty, Sep 17, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ***JB
    Replies:
    1
    Views:
    23,988
    Pennywise@DerryMaine.gov
    Dec 2, 2004
  2. Keld Landin-Petersen

    Jar Jar in Return of The Empire!

    Keld Landin-Petersen, Sep 28, 2004, in forum: DVD Video
    Replies:
    14
    Views:
    685
    Hugh Candlin
    Oct 20, 2004
  3. Keld Landin-Petersen

    Jar Jar in Return of The Empire!

    Keld Landin-Petersen, Sep 28, 2004, in forum: DVD Video
    Replies:
    0
    Views:
    354
    Keld Landin-Petersen
    Sep 28, 2004
  4. johnfraj
    Replies:
    0
    Views:
    1,535
    johnfraj
    Apr 19, 2007
  5. sbrush01@roadrunner.com

    Add file to a jar from within a Java application

    sbrush01@roadrunner.com, Sep 20, 2009, in forum: Software
    Replies:
    0
    Views:
    1,267
    sbrush01@roadrunner.com
    Sep 20, 2009
Loading...

Share This Page