How to call .bat file

hi ;
i want to call a batch file in my java programe, i have tried it but i am gettin a error any one can help me ,,
public class ExecutingBatfile {
     public static void main(String[] args) {
          try
               Runtime rt= Runtime.getRuntime();
               Process p=rt.exec("C:/DumpFile/Deliver.bat");
               int exitValue=p.exitValue();
               System.out.println( exitValue);
               //rt.exec("cmd start /c C:/DumpFile/Deliver.bat");
          }catch(Throwable e)
               e.printStackTrace();
          System.out.println("Finished");
can u advise me and correct this code , so that i can learn
thanks and regards
A.David

davvidmaria wrote:
i want to call a batch file in my java programe, i have tried it but i am gettin a error any one can help me ,,What error?
can u advise me and correct this code , so that i can learnAFAIK
Process p=rt.exec("cmd /c C:\\DumpFile\\Deliver.bat");Read this article for more details: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Similar Messages

  • How to call .BAT file in Oracle Forms

    Hi All,
    I am using Oracle Forms 6i. We have a .Bat script which moves file from our local directory to the server.
    I want to invoke this .Bat script to be called when I click on a button in the form.
    Appreciate your help here.
    Thanks,
    Madhu K.

    Hi
    I use this in oracle forms 6i: first i assign this path to a variable:
    DECLARE
    v_path   VARCHAR2(1000);
    BEGIN
    v_path:= 'C:\file_name.bat'  then I use the host command:
    HOST( 'cmd /c start' || v_path , no_screen); 
    END;Hope this helps...
    Regards,
    Abdetu...

  • Calling bat file

    how can i call bat file in my java code

    try {
    Process p = Runtime.getRuntime().exec("Batfiletorun.bat");
    .....

  • How to call PDF file in Web Dynpro Appl?

    How to call PDF file in Web Dynpro Appl?

    Hi Gobinath,
    1. Create a value attribute of type byte called pdfSource.
    2. Insert an UI element called Interactive Form in your layout
    3. Set the source property of this Interactive From UI element to the context pdfSource.
    4. Insert a button which would open your pdf file.
    public void onActionsubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionsubmit(ServerEvent)
       IPrivate<viewname>.IContextElement contextElement = wdContext.currentContextElement();
             byte[] bytes = contextElement.getPdfSource();
             try
                   File file = new File("C:
    temp
    example.pdf");
                   FileOutputStream os = new FileOutputStream(file);
                   os.write(bytes);
                   os.close();
                catch (IOException e)
                   // do something
                   e.printStackTrace();
        //@@end
    Warm Regards,
    Murtuza

  • Call .bat file from java code

    I need to call an application that uses a .bat file to execute from a java program. Is that possible?
    This is the .bat file:
    importcli.exe ciaf2735 C:\Importcli\files\SAI2735*.txt  
    importcli.exe ciaf2735 C:\Importcli\files\CI2735*.txt  
    importcli.exe ciaf2735 C:\Importcli\files\SC2735*.txt  
    importcli.exe db1800 C:\Importcli\files\*.mdb

    magaupe wrote:
    I need to call an application that uses a .bat file to execute from a java program. Is that possible?
    This is the .bat file:
    importcli.exe ciaf2735 C:\Importcli\files\SAI2735*.txt  
    importcli.exe ciaf2735 C:\Importcli\files\CI2735*.txt  
    importcli.exe ciaf2735 C:\Importcli\files\SC2735*.txt  
    importcli.exe db1800 C:\Importcli\files\*.mdb
    Hmmm, I wonder what would happen if there were a web search engine and you could research like this:
    [http://www.google.com/search?hl=en&q=call+.bat+file+from+java]

  • How to call external files from java?

    How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
    In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?

    Jayarathina_Madharasan wrote:
    no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
    From JavaRanch :
    And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
    Edited by: Encephalopathic on Apr 14, 2008 10:01 AM

  • How to call DOC file using web.show_documents

    Hi friends ,
    If I use the built-ins web.show_documents for open the *.doc file
    I am getting the following error
    ORA-06550: line 5, column 2:
    PLS-00201: identifier 'README.DOC' must be declared
    ORA-06550: line 5, column 2:
    PL/SQL: Statement ignored
    DAD name: WebDB
    PROCEDURE : readme.doc
    URL : http://132.148.160.3:80/WebDB/readme.doc?
    PARAMETERS :
    ===========
    ENVIRONMENT:
    ============
    SERVER_PORT=80
    SERVER_SOFTWARE=Oracle WebDb Listener 2.1
    SERVER_NAME=132.148.160.3
    GATEWAY_INTERFACE=CGI/1.1
    SERVER_PROTOCOL=HTTP/1.0
    REMOTE_HOST=132.148.160.251
    REMOTE_ADDR=132.148.160.251
    REQUEST_METHOD=GET
    QUERY_STRING=
    SCRIPT_NAME=
    PATH_INFO=/WebDB/readme.doc
    HTTP_ACCEPT=*/*
    HTTP_ACCEPT_LANGUAGE=en-us
    HTTP_ACCEPT_ENCODING=gzip, deflate
    HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
    HTTP_HOST=132.148.160.3
    HTTP_CONNECTION=Keep-Alive
    Please advice How to call Doc file in web.
    Thanx
    null

    The syntax to execute web.show_document:
    web.show_document('http://server_ip_or_server_name/virtual_path/filename.doc')
    The virtual path has been defined in Apache (if you run on web with Apache) or has been defined in Internet Inoformation Server (if you are runing with Internet Information Server.)
    null

  • Calling .bat file from pl/sql

    I'm running Oracle 11g R2 on win7 system, and I would like to execute .bat file from a pl/sql block.
    I created a .bat file
    I have granted privs to an account:
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee => 'COMMON', permission_type   => 'SYS:java.io.FilePermission', permission_name   => '<<ALL FILES>>', permission_action => 'execute',key => KEYNUM);
    END;
    DECLARE
    KEYNUM NUMBER;
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee => 'COMMON',permission_type   => 'SYS:java.lang.RuntimePermission',permission_name   => 'writeFileDescriptor',permission_action => '*',key => KEYNUM);
    END;
    DECLARE
    KEYNUM NUMBER;
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee => 'COMMON',permission_type   => 'SYS:java.lang.RuntimePermission',permission_name   => 'readFileDescriptor',permission_action => '*' ,key => KEYNUM);
    END;
    DECLARE
    KEYNUM NUMBER;
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee => 'COMMON',permission_type   => 'SYS:java.io.FilePermission',permission_name   => 'C:\dokumentacija\rman_backup\*',permission_action => 'read,write',key => KEYNUM);
    END;
    DECLARE
    KEYNUM NUMBER;
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee => 'COMMON',permission_type   => 'SYS:java.io.FilePermission',permission_name   => 'C:\dokumentacija\rman_backup\*', permission_action => 'read',key => KEYNUM);
    END;
    DECLARE
    KEYNUM NUMBER;
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee => 'COMMON', permission_type   => 'SYS:java.io.FilePermission', permission_name   => 'C:\windows\system32\*',permission_action => 'read',key   => KEYNUM);
    END;
    DECLARE
    KEYNUM NUMBER;
    BEGIN
      SYS.DBMS_JAVA.GRANT_PERMISSION(grantee=> 'COMMON',permission_type   => 'SYS:java.io.FilePermission',permission_name   => 'C:\windows\system32\*',permission_action => 'execute',key => KEYNUM);
    END;
    /this is Java:
    CREATE OR REPLACE PROCEDURE runoscommand(cmd IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Command.run(java.lang.String)';and this is how I call it:
    declare
    xx pls_integer;
    v_errm varchar2(400);
    begin
    xx:=0;
    xx:=archiver.fullBackup;
    dbms_output.put_line(xx);
    exception
        when others then
        v_errm:=substr(sqlerrm,1,400);
        dbms_output.put_line(v_errm);
    end;this is Java code:
    DROP JAVA SOURCE COMMON.COMMAND;
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED COMMON.COMMAND as import java.io.*;
    import java.util.*;
    public class Command{
    public static void run(String cmdText)
                         throws IOException, InterruptedException
      int rtn;
           Runtime rt = Runtime.getRuntime();
      Process prcs = rt.exec(cmdText);
      rtn =  prcs.waitFor();
    }I run this as a part of a package...
    function fullBackup return pls_integer as
    v_errm varchar2(200);
    begin
        runoscommand('C:\dokumentacija\rman_backup\bckp_level_0.bat');
        return 0;
    exception
        when others then
            v_errm:=substr(sqlerrm, 1,200);
            dbms_output.put_line(v_errm);
            return -1;
    end fullBackup;but..
    at the end, nothing happens..
    what I've been missing?

    846417 wrote:
    I changed my code in last xx minutes...OK, so you've removed all your exception handlers?
    so, now I'm calling to an exe file wich should appear at a desktop or processes list... but no..
    I gave all windows rights on that file, and also through dbms_java.grant_permission..
    but, nothing happened... not exception raised, no app. started...And no output from any DBMS_OUTPUT statement? Have you tried stepping through the code in your debugger?
    Justin

  • How to call text file using Script in Data Integrator

    Dear All,
    Can any one assit me in how to call a text file using script with the help of Data Integrator.
    and one question ?
    M having 32 csv files i want to club thos 32 csv files into one table with the help of Data Integrator, can
    any one assist me.

    mary,
    since you knew the file name ,when clicked in name send to server,read the file and write to servlet outputstream.
    I think this would help you.
    If anything wrong in mycode ..forums will help you further
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    int bytesRead=0;
    byte buff[]=new byte[1024];
    File f=new File(test.txt);
    try{
         bis= new BufferedInputStream(new FileInputStream(f));
         bytesRead=bis.read(buff,0,buff.length);
         if(bytesRead!=-1){
              // create a BufferedOutputStream from ServletOutputStream
              bos=new BufferedInputStream(response.getOutputStream());
              do{
                   bos.write(buff,0,bytesRead);
              }while((bytesRead=bis.read(buff,0,buff.length))!=-1)
    }catch(Exception e){
         ////error handling
         }

  • How to call java files from different directories

    hi, how do i call java files from a different directory??
    let say i got partA.java, and i need to include functions from partB.java which is in a different folder. how can i do that?

    Chicon wrote:
    Hi nuttynibbles,
    Before the class declaration in partA.java, you must have an import statement like :
    import someDirectory.partB;
    public class partA {
    ... and before you ask... you'll probably want to read through this http://java.sun.com/docs/books/tutorial/java/package/index.html

  • How to call text file in jsp

    Hi all,
    I can call html or jsp file from jsp file, but how can I call text file in jsp, I put my text file same lever asmy jsp file it don't work!
    where I should put the text file??
    thank you

    mary,
    since you knew the file name ,when clicked in name send to server,read the file and write to servlet outputstream.
    I think this would help you.
    If anything wrong in mycode ..forums will help you further
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    int bytesRead=0;
    byte buff[]=new byte[1024];
    File f=new File(test.txt);
    try{
         bis= new BufferedInputStream(new FileInputStream(f));
         bytesRead=bis.read(buff,0,buff.length);
         if(bytesRead!=-1){
              // create a BufferedOutputStream from ServletOutputStream
              bos=new BufferedInputStream(response.getOutputStream());
              do{
                   bos.write(buff,0,bytesRead);
              }while((bytesRead=bis.read(buff,0,buff.length))!=-1)
    }catch(Exception e){
         ////error handling
         }

  • How to call *.C file in LV

    Hi frenz,
    i have created .C file for addtion of two numbers. Now i need to call that file from LabVIEW. How is it possible?.
    Thanks in Advance 

    ragupathi wrote:
    Hi frenz,
    i have created .C file for addtion of two numbers. Now i need to call that file from LabVIEW. How is it possible?.
    Thanks in Advance 
    Well, considering the functionality you implement it would be about 1000% easier to implement that directly in LabVIEW. This is in fact a statement that is true for many programming problems although the amount of advantage you get will vary a bit.
    If you insist on using your C file approach you will have to find a C compiler that can create a DLL from that C file. This will likely require you to study a bit about DLLs and how to create them in your C compiler. And then some more studies about how to call a DLL from LabVIEW using the Call Library Node.
    But implementation of C code to be used in LabVIEW has only two really good reasons.
    1) If you already have the entire C code available and want to reuse it as library in LabVIEW. Rewriting everything in LabVIEW is in that case often not a feasable option.
    2) If you need to do low level stuff like calling into system APIs, calling device drivers, or doing general low level stuff that requires a lot of bit shuffling such as compression/decompression or encryption/decryption algorithmes.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to call HTML file from forms 6i

    Please can any one told me how i can call HTML file placed in my computer in specific path from forms 6i
    i tried web.show_Document('file path','_blank');
    but it doesn't work with me i don't know why and it doesn't give me any error
    thanks

    thanks you for your reply
    but it still not working with me
    i tried this
    host('iexplore C:\PPF\UserManual\index.htm');
    is it true, any advice

  • How to call class file from jsp without creating packages

    i m using tomcat 5.5
    i stored my class file into WEB-INF\Class directory
    how to call that class file. from my jsp page.
    i got some error.
    i used package concept,that works fine.

    i m using tomcat 5.5
    i stored my class file into WEB-INF\Class directory
    how to call that class file. from my jsp page.
    i got some error.
    i used package concept,that works fine.Then use packages.
    As of Java1.4, you can no longer import classes from the default package (no package declared) into classes that are packaged.
    All Tomcat classes are in packages, including the compiled JSP.
    Therefore: Your classes need to be in a package inorder to be imported and used by the JSP.
    Why the problem? If you know it works with packages, why try not to use them?

  • How to call static files?

    I have uploaded two documents, one MSWord and the other excel, to Shared Components / Static Files. Can someone tell me how to call these from a linked list?
    Thanks

    could any reply to this question, how to access the uploaded statis files.
    I would also like to know can we access documents which are available on NT shares without uploading the document.

Maybe you are looking for

  • Importing Opening Balances from Legacy System

    Hi All, I am trying to import opeing balances for Items, Vendors and Customers and GL a/c from legacy system to SAP B1. Can anay one of you suggest the process involved at SAP B1 end for importing the balances? I know DTW can be used, but can anyone

  • How do I install Elements 11 on my new computer.

    I purchased the digital software last year so I'm sure there was an installation e-mail sent to me but I can't find it.  I have the serial number, I just don't know what to do with it?  Can anyone help?

  • How do I set up out of office replies in mail.

    I am trying to set up an out of office automated reply for next week and can not seem to find a way of doing this. Could any one advise me how best to achieve this? Thank you in advance...

  • Datafile offline in reade only mode

    i read the oracle9i reference and it show me the message 'Read-only mode does not restrict database recovery or operations that change the database's state without generating redo data. For example, in read-only mode: Datafiles can be taken offline a

  • Create folder from role maintenance

    Hi, How can I create a folder with the name of my choice from role maintenance? I see the Role Menu from the Menu tab, but I don't see the paper icon to create a folder. Thanks