Help .. I need to call Exe program from java & run it quickly

Hi...
I have an Exe program ..
when it run in windows ( called by windows ) it takes 300 M.S
but when we called it in java It takes 3000 M.S .. Why..
where is the problem ..
... Help please
Thank u..

What are you doing with the input and output streams of the spawned process?

Similar Messages

  • I wants to call .Exe file from Java Programme

    I wants to call .Exe file from Java programme. Please give answer with example. This very urgent. Help me

    hi
    u can use Runtime.exec() method in java.lang package
    to execute exe files
    regards
    pnp

  • Calling c program from java

    Hi,
    we have written some code in c and we need to call those codes from an interface written in java. How do I do it ?
    so far as i heard, there is something call java native interface...is that true...how do i call up the c program

    java native interface...is that true...how do i call up the c program
    JNI Tutorial
    JNI Tutorial (ZIP)
    (found by the Magic of Google: JNI Tutorial)
    or Runtime.exec if you c program is a complete program.

  • Error in calling 'C'  Program from Java

    Hi,
    We developed a 'C' Program and during compilation, we got a couple of Incompatible Prototype warnings. Then we made a Jni call to 'C' program from Java Program. The program returned a "Unsatisfied Link Error - unreference Symbol not found" error.
    Does Jni call fails owing to warnings by compiler?
    We are using Sun Solaris 2.8.
    Request your assistance as this a urgent issue.
    Thanks
    Srini

    Did you try running your C program through g++? It sounds like something is broken, but GCC often will allow you to compile anyways.
    -Jason Thomas.

  • Calling PERL program from JAVA

    what is the most efficient way to call PERL scripts from JAVA class?
    please help,
    thank you,

    use of Webservices is the best answer which anyone can give you
    Alright you might have to take help of XML-RPC(by hosting perl in a remote server) to call perl routines from java Class instances.
    How you do that ?? please go ahead and try get more insight information from the below aritcle
    http://www.javaworld.com/javaworld/jw-10-2004/jw-1011-xmlrpc.html
    and if you are instrested in any other core solutions
    http://www.perl.com/pub/a/2003/11/07/java.html
    http://sunsite.ualberta.ca/Documentation/Misc/perl-5.6.1/jpl/docs/Tutorial.html
    http://search.cpan.org/~patl/Inline-Java-0.52/Java/PerlInterpreter/PerlInterpreter.pod
    http://www.perlmonks.org/index.pl?node_id=373839
    the above links might intrest you.
    Hope that might help :)
    REGARDS,
    RaHuL

  • Calling external programs from Java?

    Hi All,
    Is there a way of calling external applications from Java without using Runtime.exec(). That method seems quite messy when you are dealing with streaming data from an input file to an output file. Basically what I'm asking is there a way to run a command the same way you would type it in a command shell?
    Thanks

    LeWalrus wrote:
    Ok, I've an external application that I want to be called inside a Java GUI. It has several input arguements, which the format looks something like:
    programname inputfile > outputfile
    Simple enough.
    >
    Works fine from a shell command line. From what I understand, this won't work using Runtime.exec() because that method will just start the application. Works fine from Runtime.exec(). Since you are'>' to write stdout to a file you need to us a shell to execute the command.
    String[] command = {"sh", "-c","programname inputfile > outputfile"};
    Process process = runtime.exec(command);
    You need to read, digest and implement the recommendations given in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .
    File input and output from the application has to be taken care of programatically (java.io stuff). Fine if you've only one input and output. But if you have several input files and hundreds of output files, where does this leave you. It would be much easier if you could pass a string command to the shell directly as if you typed it in the command line yoursel!

  • Need to call OAF API from JAVA concurrent program

    Hi Gurus,
    I am trying invoke an OAF Application method which generate the Batch ID. I am trying the invoke the same from JAVA Concurrent program. Below is teh code used,
    package oracle.apps.ego.item.cp;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import oracle.apps.ego.item.common.server.EgoBatchHeader;
    import oracle.apps.ego.item.itemimport.server.EgoImportBatchHeaderAMImpl;
    import oracle.apps.fnd.cp.request.CpContext;
    import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
    import oracle.apps.fnd.cp.request.LogFile;
    import oracle.apps.fnd.cp.request.OutFile;
    import oracle.apps.fnd.cp.request.ReqCompletion;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.ApplicationModuleCreateException;
    import oracle.jbo.ApplicationModuleHome;
    import oracle.jbo.JboContext;
    import oracle.jbo.domain.Number;
    import oracle.jdbc.internal.OracleCallableStatement;
    public class XX_EGO_BATCH_CREATE implements JavaConcurrentProgram {
    static LogFile log = null;
    public void runProgram(CpContext ctx){
    //Obtain the reference to the Output file for Concurrent Prog
    OutFile out = ctx.getOutFile();
    EgoBatchHeader v_header = new EgoBatchHeader();
    //Obtain the reference to the Log file for Concurrent Prog
    log = ctx.getLogFile();
    log.writeln("Batch Number Creation", 0);
    ApplicationModule am = null;
    try{
    //Write your logic here
    log.writeln("Batch Number Creation", 0);
    log.writeln("definition of batch num",0);
    Number batch_num;
    Number ssid = new Number(10000);
    String jdbcUrl =
    "jdbc:oracle:thin:apps/[email protected]:10201:ARERP4";
    ApplicationModule am_Member = null;
    log.writeln("Before Calling Create method",0);
    am_Member =
    create("oracle.apps.ego.item.itemimport.server.EgoImportBatchHeaderAMImpl",
    jdbcUrl);
    log.writeln("assigning ssid"+ssid,0);
    EgoImportBatchHeaderAMImpl bheader = new EgoImportBatchHeaderAMImpl();
    log.writeln("bheader object is :"+bheader,0);
    log.writeln("calling getBatchObjectForCreate"+bheader,0);
    v_header = bheader.getBatchObjectForCreate(ssid);
    //System.out.println("v_header is :" + v_head);
    log.writeln("calling createBatch"+v_header,0);
    batch_num = bheader.createBatch(v_header);
    log.writeln("Batch Number is :"+batch_num ,0);
    out.writeln("This will be printed to the Output File");
    log.writeln("This will be printed to the Log File", 0);
    //Request the completion of this Concurrent Prog
    //This step will signal the end of execution of your Concurrent Prog
    ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL,"Completed.");
    //Handle any exceptional conditions
    catch(Exception e){
    log.writeln("Exception2 occurred here !!"+e,0);
    log.writeln("calling createBatch"+v_header,0);
    public static ApplicationModule create(String amDefName,
    String jdbcConnStr) throws ApplicationModuleCreateException, Exception {
    ApplicationModule am = null;
    try {
    OracleCallableStatement conn = null;
    // Setup the hashtable of JNDI initialization parameters
    log.writeln("inside create method .. ",0);
    Hashtable env = new Hashtable(2);
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    JboContext.JBO_CONTEXT_FACTORY);
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
    // Create an JNDI initial context
    Context ic;
    ic = new InitialContext(env);
    // Lookup a home interface (factory) for the AppModule by name
    ApplicationModuleHome home =
    (ApplicationModuleHome)ic.lookup(amDefName);
    if(home==null){
    log.writeln("home is null... .",0);
    }else{
    log.writeln("home is not null"+home,0);
    // Create an instance of the AppModule using the home/factory
    am = home.create();
    if(am!=null){
    log.writeln("am is not null"+am,0);
    }else{
    log.writeln("am is null",0);
    // Connect the application module to the database
    am.getTransaction().connect(jdbcConnStr);
    } catch (NamingException ex) {
    log.writeln("NamingException occurred here !!"+ex.getMessage(),0);
    ex.printStackTrace();
    throw new ApplicationModuleCreateException(ex);
    }catch(Exception ex){
    log.writeln("Exception occurred here !!"+ex.getMessage(),0);
    ex.printStackTrace();
    throw new Exception(ex);
    return am;
    I am not able to call the web server and facing issues. Please let me know if you can help me to get a solution to this.
    Thanks in advance
    Veerendra

    Hi Zafar,
    I got an error saying :
    Batch Number Creation
    Batch Number Creation
    definition of batch num
    Before Calling Create method
    inside create method ..
    home is not nulloracle.jbo.server.ApplicationModuleHomeImpl@11d2572
    Jul 9, 2008 5:04:21 AM oracle.adf.share.config.ADFConfigFactory findOrCreateADFConfig
    INFO: oracle.adf.share.config.ADFConfigFactory No META-INF/adf-config.xml found
    Exception occurred here !!JBO-25002: Definition oracle.apps.ego.item.itemimport.server.EgoImportBatchHeaderAMImpl of type ApplicationModule not found
    oracle.jbo.NoDefException: JBO-25002: Definition oracle.apps.ego.item.itemimport.server.EgoImportBatchHeaderAMImpl of type ApplicationModule not found
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:441)
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:358)
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:340)
         at oracle.jbo.server.MetaObjectManager.findMetaObject(MetaObjectManager.java:700)
         at oracle.jbo.server.ApplicationModuleDefImpl.findDefObject(ApplicationModuleDefImpl.java:232)
         at oracle.jbo.server.ApplicationModuleImpl.createRootApplicationModule(ApplicationModuleImpl.java:401)
         at oracle.jbo.server.ApplicationModuleHomeImpl.create(ApplicationModuleHomeImpl.java:91)
         at oracle.apps.ego.item.cp.XX_EGO_BATCH_CREATE.create(XX_EGO_BATCH_CREATE.java:139)
         at oracle.apps.ego.item.cp.XX_EGO_BATCH_CREATE.runProgram(XX_EGO_BATCH_CREATE.java:57)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
    Exception2 occurred here !!java.lang.Exception: oracle.jbo.NoDefException: JBO-25002: Definition oracle.apps.ego.item.itemimport.server.EgoImportBatchHeaderAMImpl of type ApplicationModule not found
    calling [email protected]9c

  • Calling RPG program from Java

    Hi All,
    I'm somwhat new to Java (coming from an AS400 background) and I'm stuck with what I think is a fairly simple problem. But I've been looking at this for so long, I'm probably missing something really simple and I hope someone can help me with this.
    I've created a bean that needs to call an RPG program on the AS400. I've looked at code throughout this site to compare and it looks the same. My problem is I'm getting an error when I try to run it.
    "com.ibm.db2.jdbc.app.DB2SQLException2: [IBM][JDBC Driver][14012] The index for the parameter is not valid."
    Here's my code:
    CallableStatement stpCall ;
    String sql = "CALL LIB.CHECKLOGIN ( ?, ?, ? )" ;
    try {
    Connection connection = null;
    connection = ivDataSource.getConnection();
    stpCall = connection.prepareCall( sql ) ;
    stpCall.setString( 1, ivUserID ) ;
    stpCall.setString( 2, ivPassword ) ;
    stpCall.registerOutParameter( 3, Types.INTEGER ) ;
    stpCall.execute() ;
    } catch (Exception e) {
    System.out.println(e);
    I've tried it a couple different ways and still get the same error. So if anybody can let me know what I'm missing or what I'm doing wrong I would greatly appreciate it. Thanks.

    Thanks jedilowe.
    Here's the code I'm trying to run:
    CallableStatement stpCall ;
         String sql = "CALL CHECKLOGIN ( ?, ?, ? )" ;
         Connection connection = null;
         connection = ivDataSource.getConnection();
    try {
    stpCall = connection.prepareCall( sql ) ;
    stpCall.setString( 1, ivUserID ) ;
    stpCall.setString( 2, ivPassword ) ;
    stpCall.registerOutParameter( 3, Types.INTEGER ) ;
    stpCall.execute() ;
    ivError = stpCall.getString(3) ;
    } catch (Exception e) {
    e.printStackTrace();
    I'm looking through the stderr log now. Most of if looks like a foreign language, but do you have an idea of what to look for? Anything specific? Here's a few lines from the log:
    com.ibm.db2.jdbc.app.DB2SQLException2: [IBM][JDBC Driver][14012] The index for the parameter is not valid.
    java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94)
    java/sql/SQLException.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:43)
    com/ibm/db2/jdbc/app/DB2SQLException2.<init>(Ljava/lang/String;Ljava/lang/String;I[B)V+1 (DB2SQLException2.java:281)
          com/ibm/db2/jdbc/app/DB2SQLException2.generateException(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;Ljava/lang/String;I[B)Lcom/ibm/db2/jdbc/app/DB2SQLException2;+19 (DB2SQLException2.java:260)
          com/ibm/db2/jdbc/app/DB2PreparedStatement.beforeSetXXX(I)I+86
    Can anyone decifer this mess and based on the code above, tell me what the heck is wrong with the code!!! I've been fighting this for almost a week now. Thanks for all your help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

  • Calling windows programs from Java

    Hello,
    I need to find how to call and pass parameters to windows programs. Specifically I need to call MS Sql server, there is call that I can do from command promt but I would like to give it some GUI interface and ease of use so I could pass some parameters to the program and execute it.
    Thanks.

    Hi thanks for all replies !
    Ok let me explain more about my problem.
    I have a SQL server which runs on MS machine and there is thousands of stored procs that my be recreated once in a while from a directorys. So we have scripts which we have to manually update every time new stored proc is written and run against the server to update all of them at one batch.
    Now I often have to browse to this directory from linux machine and I basically already written the Java program that gets all the files in the directory and passes them via JDBC to the server.
    Thats where the problem starts, when you calling and passing sp to sql without any header seting the jdbc is fine but when you pass sp with such settings for instanse as "SET QUOTED_IDENTIFIER and SET ANSI_NULLS OFF" in the header of stored proc then SQL server complains and fires exceptions on me.
    So this is my problem.

  • Calling RPG program from SAP running on windows platform.

    Hi
    We want to call a RPG program used for sending and receiving data to SAP System.  Our sap system running on windows platform and RPG program run iseries V5R3
    How can we do this?
    We red the redbook http://www.redbooks.ibm.com/redbooks/pdfs/sg244672.pdf. We thought it only mention about sap and externel system is as/400 and it is not related with our issue but we are not sure.
    We are waiting for an urgent suggestion.
    Best Regards...

    Hi, We also need to call RPG from ABAP via RFC. We have installed the RFC SDK on A/S400 and tried call ABAP RFC from RPG, but still don't know how to make RPG program callable from ABAP
    Any advice!
    Many thanks
    Tim

  • Call other programs from Java

    There is this command line program I want to wrap with a Java class in order to make it available so that it can be transparently called.
    How can I call or execute external programs/commands from JAVA...
    is not native code that I want to run...
    Thank you

    Runtime.getRuntime().exec("your command line")... you could read more about it in the API documentation.

  • Calling exe files from java

    heyy
    can anybody please help me out in calling an exe file using java??
    also i would like to pass parameters tooo.
    i have been trying the following runtime code
    but found no success
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("make.exe 12");
    proc.waitFor();
    int exitVal = proc.exitValue();
    Does anybody havea better soultion???
    Thanks for your time
    Rachit

    Read this article, please http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Urgent: How to use ORA_FFI to call exe program from Report 6i

    We follow report help to use ORA_FFI but it does not work. Kindly help to advise sample code for using it.
    Steven

    u can solve this problem with lexical parameter.
    create a user parameter and use it as lexcical parameter.
    create a ur on form with form builder instead of report default parameter form and run reprport with parameters.
    here is an exmple that i used.
    if :Month is not null and :year is not null and :sjnl_no is not null then
    declare
    plist paramlist;
    begin
    plist := get_parameter_list ('list_1');
    if not id_null(plist) then
    destroy_parameter_list (plist);
    end if;
    plist := create_parameter_list ('list_1');
    add_parameter (plist, 'P_where', text_parameter,'and (doc_no='||:SJNL_NO||')and to_char(doc_date,''MON-YYYY'')='''||:MONTH||'-'||:Year||'''');
    add_parameter (plist, 'DESTYPE', text_parameter,:des_type);
         run_product(REPORTS,'sale_journal', SYNCHRONOUS, RUNTIME, FILESYSTEM, plist);
    exit_form;
    end;
    else
              Message ('Select Moth, Year and Document No. first.');
    end if;
    Qadeer

  • Need to call Win API from Java

    Can anyone direct me where to look for clues/answers?

    See http://jnative.sf.net
    I gived a sample of use of Win32 API in this thread : http://forum.java.sun.com/thread.jspa?threadID=704737
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                           

  • Calling c code from java

    hello everyone
    I have question
    I need to call c program from java
    I don't have problem with application or exe file in c it is working but when I call it from java it doesn't work there is no error but it doesn't work because when I execute the c program the black screen must be appeared so that I can enter the input file and then it produces the output file but in java I cann't see the black screen so please can you tell me the problem
    I have used the following code to call c from java:
    String line;  
                   String output1 = "";  
                         Process p = Runtime.getRuntime().exec("cpp.exe");  
                         BufferedReader input = new BufferedReader  
                               (new InputStreamReader(p.getInputStream()));  
                         while ((line = input.readLine()) != null) {  
                               output1 += (line + '\n');  
                         input.close();

    Hi,
    Try this in your code
    p.waitFor();It is for waiting of the process till the completion of the I/O.
    Regards

Maybe you are looking for