How to execute a file using jsp or java

hi..
i had a jsp file as front end with start and stop button,
if i click the start button a file on my pc should execute.
if stop button is clicked the file should stop execution.
Any one know how to do this..especially how to run a file in ur system using java..
Thanks in advance

thanks for u r quick replies...
Actually i want to run a file on a client machine
only...
Okay.
for example, a client should execute a file which is
in another client...
This is not the same thing as what you just said.
can u tell me the method to execute the file......java.lang.Runtime.exec

Similar Messages

  • How to execute batch file from JSP

    hi frens !
    i wanna know how to execute batch file from my JSP.i am using exec() method to get call the batch file. but its not working ....plz help
    here mine code:-
    File F = new File("C:/var.bat");
         try{
          if (F.exists())
            Runtime rt = Runtime.getRuntime();
            String url=F.getAbsolutePath();
             Process proc = rt.exec(url);
            proc.waitFor();
            proc.destroy();
            catch(Exception IOEx){
           System.out.println(IOEx);
      }Thanks and Regards
    Allwyn

    You might improve your chances of getting help if you do two things:
    1) Explain what "not working" means.
    2) ChangeSystem.out.println(IOEx); to IOEx.printStackTrace(); (in the eventhat is in fact related to "not working").

  • How to execute .sql file using ODI

    Hi All,
    I need to execute .sql file using ODI.
    I tried @{path}{file} command in ODI procedure selecting oracle technology.but it is failing.
    Do any one have any other idea to execute .sql file.
    Thanks in advance

    Ohk...I think you can try creating batch file(.bat) if its Windows & call that from ODIOSCommand.
    The bat file should contain scripts which call .sql file using sqlplus  & there you can use @{path}{file} format.
    See if this helps.
    Regards,
    Santy

  • How to execute ".exe" files using java

    Hi,
      This is guruvulu,
         I have a problem in executing ".exe" files.For Example InternetExplorer.

    Hi,
    You can execute .exe files in JAVA using the following code.
    Runtime rt1 = Runtime.getRuntime();
    Process pc = rt1.exec("someexe.exe");
    you can get the output of the executed exe file in
    in = pc.getInputStream(); //this returns a InputStream
    hope this solves your problem.
    regards,
    P.Venkat

  • How to execute Bat Files using Jobs?

    Hello, can anyone help me?
    I have created a job like this, but it's not working:
    begin
    dbms_scheduler.create_job(
    job_name => 'job_test'
    ,job_type => 'EXECUTABLE'
    ,job_action => 'C:/temp/test.bat'
    ,start_date => '01/DEC/2006 08:30 AM'
    ,repeat_interval => 'FREQ=DAILY'
    ,enabled => TRUE
    ,comments => 'Demo for job schedule.');
    end;
    begin
    DBMS_SCHEDULER.run_job (job_name => 'job_test',use_current_session => false);
    end;
    Thx!

    Hi,
    This will not work because a batch file is not directly executable. It is executed using cmd.exe .
    So what you need to do is to set c:\windows\...\cmd.exe as the job_action and then as your arguments set
    /q
    /c
    c:\test.bat
    then enable the job. This should work.
    Also make sure the job scheduler service is setup and started (it needs to be started for external jobs to run).
    There is an example given by scotttig in this thread
    Re: dbms_scheduler
    Hope this helps,
    Ravi.

  • How to generate .xsd file using jaxb generated java files

    Hi,
    We need to upgrade our applicatio to jdk1.6 which has jaxb2.0 class files in it. Our application has java files generated from .xsd using jaxb1.0.2 version. At present we dont have .xsd or .xml file with us.
    We decide to generate .xsd file by using jaxb1.0.2 generated java files. I tried using schemagen.exe given by jdk1.6 to generate .xsd file. It error out. Is there any other way to generate .xsd file ?
    pls let me know.
    thanks,
    Thiru

    Object-XML mapping is a new feature in JAXB 2.0. Classes generated with JAXB 1.0 won't generate a schema.
    Generate Java classes with JAXB 2.0 xjc.
    http://www.theregister.co.uk/2006/09/22/jaxb2_guide/

  • How to execute sh file of unix in java

    iam trying to execute a sh file in target machine which will startup the database from source machine..
    sh file is ..
    # Synopsys
    # This program startup's the database.
    # Parameters
    # @1: tuserconnect
    # @2: tenvfile
    # @3: tUserHome
    progname=ajstartdb
    echo "ssh ${1} . ${2} \&\& ${3}"
    ssh ${1} . ${2} \&\& ${3}/ajss/sql/ajstrtdb.sh
    retval=$?
    echo "DEBUG::${progname}--> Completing execution with return code: $retval" > $progname.out
    If i try to execute this ajstartdb.sh file in target itself it is executing perfectely.So i think no prob's with sh file..
    but when i try to execute this sh file from java.. the process control is remaining in the prgm itself even after the cmd is executed.. i mean prgm is not exiting.
    java prgm is :
    import java.io.*;
    class StartShut1
    public static void main(String[] args)
    try {
    String cmd="ssh [email protected] . /d03/AppsGOLD/golddb/9.2.0/GOLD_hydapps.env \\&\\& /home/oragold/ajss/ajstrtdb.sh";
                             System.out.println(" the cmd is: "+cmd);
         Process p =Runtime.getRuntime().exec(cmd);
         int i = p.waitFor();
         System.out.println("Exit value of process is "+j);
                             System.out.println("Output of the Cmd is : "+i);
         String s=null;
         if (i!=0){
                                  System.out.println("ERROR in executing the command");
                                  BufferedReader cmdr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
         while ((s = cmdr.readLine()) != null) {
                                                 System.out.println(s);
                                                      s = null;
         BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
                                       // read the output from the command
                                       s=stdInput.readLine();
                             System.out.println(s);
         while (s!= null)
         System.out.println(s);
    InputStream in = p.getInputStream();
    int ch;
    StringBuffer sb = new StringBuffer(512);
    while ( ( ch = in.read() ) != -1 )
    { sb.append((char) ch); }
    System.out.println("output from string buffer"+sb);
    }catch(Exception e)
    System.out.println("ERROR :"+e);
    e.printStackTrace();
    }//main
    }//class
    Kindly Reply me if u get an idea

    And also u hv specified & in the cmd ... it is executing when we specify \&\& there.
    Do u hv any idea ragarding this symbol (\&\&) in unix..Let us try first without vowels (the OP tends to drop them):
    & n cmmnd prmpt wll trmnt th cmmnd nd rn t n th bckgrnd.
    && wll wrk lk n C (r Jv fr tht mttr): t wll vlt th frst trm nd g n xctng nd vltn
    g f t ws "tr", tht s, f t yldd "zr" s rtrn cd.
    For the faint the one with vowels:
    & in a command prompt will terminate the command and run it in the background.
    && will work like in C (or Java for that matter): it will evalute the first term and go on executing and evaluating if it was "true", that is, if it yielded "zero" as return code.
    Thus
    posman@proli:~/ivan/fnt> test -d mydir && ls -l mydir
    posman@proli:~/ivan/fnt> mkdir mydir
    posman@proli:~/ivan/fnt> ls >mydir/1
    posman@proli:~/ivan/fnt> test -d mydir && ls -l mydir
    total 4
    -rw-r--r--  1 posman users 522 Oct  4 12:24 1

  • How to export .txt file using JReport in java?

    Hi all,
    private void generateTEXTOutput(JasperPrint jasperPrint,)throws IOException, JRException {
    try
    String fName=filename+".txt";
    JRTextExporter export = new JRTextExporter();
    export.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    export.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "textfile.txt");
    export.exportReport();
    }catch (Exception e) {
    System.out.println(e);
    I got this Exception.
    "net.sf.jasperreports.engine.JRException: Character or page width must be specified"
    How to rectify?
    Plz., any one help me....

    hey i know....
    just i vant to know from this forum...but u guys are pissed me out....
    this is too bad..
    i going to write the mail to this forum head....in future any of the topic is not related..u should have tell me before to continue further quetions...
    anyway this is the worst insult i am feeling....
    Thanks for all of ur support for me....hereafter i am not going to post any mails to this forum...
    all the best... f....k
    Cheers
    Mad Mohan

  • How 2 get the path of a file Using jsp

    how 2 get the path of a file Using jsp
    i have tried getPath...but i'm geting the error
    The method getPath(String) is undefined for the type HttpServletRequest
    any idea how 2 get the path of a file

    You need ServletContext#getRealPath().
    API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)

  • How to upload a image file using JSP

    hello to all.
    i am in the learning stage please help me to upload a image file
    using jsp. give the explanation to the code also if possible.
    thanks in advance
    sincerely
    Chezhian

    You may find the following articles useful for the JSP/Servlet part:
    Uploading files: http://balusc.blogspot.com/2007/11/multipartfilter.html
    Downloading files: http://balusc.blogspot.com/2007/07/fileservlet.html

  • How to Upload a file in JSP ( doc,  txt ) as an attachment

    I want to upload a file using JSP. I tried Jason's Multipart program, but it is creating some problem. Pls suggest me the alternate. How to write a code. Is there any bean available for free download. Pls. help me.
    - Ashok Mudalagi
    [email protected]

    I have successfully used Multipart classes from Oreilly. I believe that's the same one you are referring to. I have implemented my Upload using a servlet though. If you can post what exactly is your trouble using that code, I will be glad to help you with it.

  • How to upload a file using java bean?

    hi,
    i need a code simple how to upload a file from jsp form to a java bean file (not a servlet)
    thank,s zik

    Hi,
    i need a code sample how to upload a file from jsp
    form to a java bean file (not a servlet)You can use jspSmartUpload component which is a free, fully-featured JSP component.
    jspSmartUpload provides you with all the upload/download features you could possibly wish for :
    * Simple and complete upload
    * Total control over the upload process
    * �Mixed forms� management
    * Total control over files sent
    * Download whatever you want
    For further information about jspSmartUpload please visit
    http://www.jspsmart.com/
    Hope this helps.
    Good Luck.
    Gayam.Srinivasa Reddy
    Developer Technical Support
    Sun Micro Sysytems
    http://www.sun.com/developers/support/

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

  • Executing *.xml files as *.jsp files

    Under other web containers this usually takes about 4 lines in a config xml file.
    I am still hunting through the online doco
    but I was wondering if anyone could point
    me to the relevant section quicker ? ...
    Basically what I am looking to do is to
    tell the server to parse and execute *.xml
    files as *.jsp files. It should be a simple
    mapping somewhere in the config files.
    Thankyou in advance,
    Brian.

    Chuck,
    That isn't quite what I want to achieve. What I have done
    elsewhere is place the following servlet mapping in the Web
    Container's web.xml file.
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.xml</url-pattern>
    </servlet-mapping>
    which then causes all *.xml files to be processed as *.jsp files.
    Servlet name being the name of the servlet that processes the
    JSP files for the web container. Is there an equivalent
    thing under BEA ? Does BEA have a servlet which processes
    JSP files or does it use something different ?
    Cheers,
    Brian.
    "Chuck Nelson" <[email protected]> wrote:
    >
    Brian,
    You should be able to update the web.xml for this purpose
    e.g.
    <servlet>
    <servlet-name>myFoo</servlet-name>
    <jsp-file>SnoopServlet.xml</jsp-file>
    </servlet>
    See the following URL for a more detailed description
    http://edocs.bea.com/wls/docs61/webapp/components.html#100437
    Chuck Nelson
    DRE
    BEA Technical Support

  • Read an excel file using JSP in MII 12.1

    Hi,
    I want to read an excel file using jsp page. I dont want to use the UDS or ODBC for connecting to excel.
    I am trying to use org.apache.poi to read the excel file in jsp page.
    While running, its showing a compilation error "package org.apache.poi.hssf.usermodel does not exist"
    I have the jar files for it, where do we need to upload it so that jsp page works.
    Thanks a lot
    Regards,
    Neha Maheshwari

    The user doesn't want to save the excel file in server.
    I want to upload file and save its contents in database.
    I have the code to read and save excel data in database but not able to get the location to deploy the jar file.
    In general, if we are creating a jsp page in MII workbench which is using some jar file.
    Whats the location to upload this jar file so that the jsp page works correctly?

Maybe you are looking for

  • Order not available in ECC6.0 where as the same order is in SAP CRM?

    Hi SAP Experts, I have come up with one issue  as follows: I have changed the sales order in SAP CRM  and when i try to open the same document in ECC 6.0 in TCode:VA02,it is directing to logon screen with user ID and Password.When i input my logon de

  • Calling Java Function with Return as String []

    Hi, I have written the following code. It's not compiling OK. DECLARE TYPE Tokens_Type IS VARYING ARRAY(20) OF VARCHAR2(20); s1 Tokens_Type DEFAULT NULL; SQL_STR VARCHAR2(2000) DEFAULT NULL; BEGIN SQL_STR := 'CREATE OR REPLACE FUNCTION Schema1.SPLIT_

  • What is the role of PrepareForDML() in ADF JDEVELOPER

    Hi All, i am using Jdeveloper 11g ver-11.1.1.5.0 I want to know that what action we can perform with PrepareForDML() in ADF ? Please tell me the answer thank you.

  • Hyperion Shared Services JAPI.

    Hi , I am looking for Shared Services JAPI to fetch couple of things, but when i am running the code i am getting the below errors. I guess i am not able to find proper JAR files to Import. Any suggestions on the below ?? Djavax.net.ssl.trustStore=C:

  • REP-51002: Bind to Reports Server failed

    Hi, I have installed Oracle Database 10g R2 and Oracle Developer 10gR2. I installed it in both Windows 2000 SP4 and Windows XP SP2. I would like to call a Report using a button inside Oracle Form. I create my own Report Server, using : rwserver serve