Irregular delay while running a dos batch file using a servlet class

i used RunTime( ) class to execute a dos-batch file containing some commands like changing the directory, running an exe(executable.exe) file...etc in a servlet class. while this servlet class is invoked, the exe file(executable.exe) is run after irregular delay at different trials.
Note: When this batch file is run in a stand alone java class, it is working fine.
what can be the possible cause of this prob? Help me in this.

It's ok - I've found the answer.
I'll post it here for anyone else who is interested.
The problem stemmed from the fact that I had to put the path to javaw.exe in quotes, as the batch file is dynamically generated from the user's environment, and then run. The user's system properties gives a path to java home using a full path name, which WinNT/Win2K doesn't like.
The following batch file content solves it, closing the DOS box after starting javaw.exe. Before this part of my batch file, there is just some file copying that goes on for the autoupdate process.
set PATH=%PATH%;"D:\Program Files\JavaSoft\JRE\1.3.1\bin"
start /B javaw.exe -Dmyapp.home=C:\myapp myapp.client.MyAppClient subSys
exit
The parameter subSys is just a command line parameter that MyApp.java looks for, so not relevant for everyone.
/B prevents a second DOS box from opening.
exit simply closes the DOS box once the javaw.exe process has started.
Too easy! Although I can't believe how difficult it was to find information about this. Hopefully it will be of benefit to others.

Similar Messages

  • How could I have a VI execute a DOS batch file?

    I need to update the PC's hardware timeclock and the Windows clock via a VI front panel. If I can update hardware and windows timeclocks from a DOS prompt (TIME/NEW TIME), is there a way to provide a LV interface for the same operation? If a VI could run a DOS batch file, having the operator enter a new time in a DOS prompt window is the next best thing.
    Thanks,
    Jeff Bledsoe
    Jeffrey Bledsoe
    Electrical Engineer

    tst wrote:
    The syntax is that of the operating system.
    Have you tried right clicking the VI and selecting Help?
    I found the online example by selecting help. I'm using LV 5.1 and I've noticed that offline help is not as detailed as it is with LV 7 Student Edition (I have student edition at home).
    In my latest attempts, I have the string "command.com /c time" wired to the command line input of system exec.vi. I get the dos prompt and a request for a new time.
    To avoid the operator having to enter the time in the DOS window, I tried passing carriage returns and a time update value in the command line input. It didn't work. Do I have to add a system exec.vi for each command line entry and concatenate the vi's somehow?
    Thanks,
    Jeff
    Jeffrey Bledsoe
    Electrical Engineer

  • Running a Batch file Using Java

    hi All ,
    I am executing a DOS batch file using the Java .
    I am using it as
    Process P;
    Runtime rt = Runtime.getRuntime();
    P = rt.exec("C:\\X12TST\\BATCH1.BAT ");
    But in case BATCH1.bat have call to some other Batch File Say Bactch2.bat , i am not getting the output of BATCH2.BAT .
    My Java Program exits as soon as it enters to the point where BATCH1 is calling BATCH2 using (call BATCH2.bat).
    Any help is resolving the problem is highlt appreciated .
    Please advise me if you have any alternative to solve the problem .
    Thanx in advace

    The Runtime.exec() should'nt be used with a .bat or .cmd file since .bat and .cmd are not really executable. I think the expected behaviour you experimentred is a process hang at the last command line of the .bat file.
    Insert "echo XXX" or "net send mycomputer XXX" debug messages in your .bat, you'll see the .bat executes until last line. But the last one NEVER terminates, resulting in a hang in the Java thread doing a process.waitFor().
    The only workaround (or right use of exec) is to call the cmd.exe (with FULL PATH OF cmd.exe SPECIFIED in the exec() call). An exec() calling C:\WINNT\System32\cmd.exe /C mybatch.bat should return properly, cause cmd.exe is a standard Win32 program that will be launched to interpret mybatch.bat then terminate.
    PLEASE UNIX/LINUX USERS : report if the behaviour you get is the same on your plat-form, or if it is -one more- bug in win32 OS. Can you exec() a shell script direcly or do you have to exec() a "bash" or "ksh" or "csh" with you shell script as command line argument ?

  • Run a MS DOS batch file from the client

    Hi,
    I created a java source to run a bat file, the folder is loacted in the Database server.
    (Not in application server)
    create or replace and compile java source named execcommand as
    import java.io.*;
    import java.util.*;
    public class ExecCommand{
    public static void run(String cmdstr) throws IOException, InterruptedException
    try {
    int rtn;
    cmdstr = "cmd /c " + cmdstr;
    Process prcs = Runtime.getRuntime().exec(cmdstr);
    while (prcs.getInputStream().read() != -1 ) {}
    catch (IOException e) {
    e.printStackTrace();
    I called the java source from the procedure
    create or replace procedure run_batfile is
    begin
    execcommand(cmdtext => 'e:\services\genPDF.bat');
    dbms_output.put_line('file created successfully');
    exception
    when others then
    dbms_output.put_line(sqlcode || sqlerrm);
    end run_batfile;
    But the bat is not executing (The bat file is to generate a PDF file ). Bu when i executing this from my PC (Client PC) directly on the RUN , its generating the PDF file in the server.
    What could be the problem, What should be the path in the procedure,
    Shall i create any virtual directory ?
    Thanks in advance,
    Rizly

    Hi Justin ,
    Sorry for the late replay.
    I am running Oracle on Windows.
    The MS DOS Batch file is to convert XML file to PDF format. It is a Java Application.
    also it is a batch process, thats why i created a batch file for that. I am using FOP to convert XML to PDF.
    FOP is in the e:\services folder of the Database Server machiene. XML file is also in the same forlder and I need to generate the PDF file also in the same machiene.
    <<- You have a client machine. What do you mean by "executing this from my PC (Client PC) directly on the RUN , its generating the PDF file in the server.">>
    I have mapped the e:\services folder in my client machience, so i am accessible to the genPDF.bat file that is in the 'e:\services' folder of the DB Server. When i run the bat file from my PC as Start > Run e:\services\genPDF.bat . The PDF file has generated in the DB Server machien.
    I dont have the copy of the batch file in client machiene, but i have mapped to my client machiene.
    Thanks again,
    Rizly

  • How do I stop ODI if my DOS BATCH file flags an error?

    I have a DOS batch file as the first step in my ODI package. How do I send a code to ODI to tell it that it has failed and to stop processing the rest of the package? I was told I could use an ODI variable to accomplish this but not sure how.
    Also, how do I pass a semaphore/flag an error in my DOS batch file to ODI ?
    Thanks in advance for your help.
    I tried to search for this info in John's blog: http://john-goodwin.blogspot.com/search?q=error
    but was not able to find it.
    :)

    In your package 1st step is OS Command then some other steps involved, right ?
    In that case you can have your package like this
    OS Command (first step) ---------OK--------------> 2nd step -------------------> 3rd step
    So your 2nd step will run only when the 1st step is successful, it will not start 2nd step as 1st itself has failed .
    Thanks,
    Sutirtha

  • How to call/Execute a dos batch file via LAN

    Hello,
    Can i execute remotely dos batch files?
    I have to execute bat file via LAN ex
    IP\dir\batfile.bat from abap code, is that possible?
    thanks in advance,
    Michal

    Hi,
    Use CL_GUI_FRONTEND_SERVICES=>EXECUTE method to run any application in your case batch file..
    The batch file you are trying to run should be accessible on presentation system i.e. user's machine.
    Regards,
    Vishal

  • Running a windows batch file on the middle teir

    Hi, I am converting a client/server Forms app to 10iAS (9.0.4). in Client Server mode, one of the forms calls a batch file that runs on the client. The same batch file must now run on the middle teir app server where iAS is installed, not the client's computer (no need for WebUtil).
    No change was made to the batch file, and it can be run with supplied params at the command prompt on the iAS server. However, when run through the web app, the batch file is failing. It is being executed, but when it hits this line:
    FOR %%F in (%1\arp*.w) do type %%F | gawk -f ARKeys.awk | gawk -f SMSar.awk
    it fails.
    Q: is there a different method to program DOS batch files wheb being called from the Forms server?

    Hi, I am converting a client/server Forms app to 10iAS (9.0.4). in Client Server mode, one of the forms calls a batch file that runs on the client. The same batch file must now run on the middle teir app server where iAS is installed, not the client's computer (no need for WebUtil).
    No change was made to the batch file, and it can be run with supplied params at the command prompt on the iAS server. However, when run through the web app, the batch file is failing. It is being executed, but when it hits this line:
    FOR %%F in (%1\arp*.w) do type %%F | gawk -f ARKeys.awk | gawk -f SMSar.awk
    it fails.
    Q: is there a different method to program DOS batch files wheb being called from the Forms server?

  • Scheduling unix shell scripts from windows using DOS batch files

    Hi,
    I want to schedule unix shell scrips using windows scheduled. I have the option of scheduling the DOS batch files. But not able to connect to telnet using DOS. Please let me know if there is an option.
    Regards,
    -Anand

    Drive letters are user specific. When you run jboss it runs as you, with your shared drives. When you run it as a service, it runs as guest or another user so your drive letters are meaningless.
    Either setup the user or use UNC

  • How to run a batch file using tigger....

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    sorry wrong foum to post.
    will post in the correct one
    how to run batch file using trigger?

    Hallo,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question should be placed in {forum:id=75} or {forum:id=61}.
    When you post your question there please provide additional information like db version, what kind of trigger you want to use, how you want to prevent the execution when the transaction is rolled back... {message:id=9360002}
    Regards
    Marcus

  • How to run the emca batch file

    Hello,
    I would just like to know how to run the emca batch file for a single test database on my PC with SID = ORCL1.
    Hope someone can help me.
    Thanks!

    Hi
    If you mean running EMCA as batch file and test something.
    I think the best way is to write OS level script to handle this

  • Getting ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME. Error while run Financial Reporting Batch Scheduler

    Hi,
    I am running Financial Report batch file via command line i am getting below error.
    D:\Oracle\Middleware\EPMSystem11R1\products\financialreporting\bin>ant -q -f "D:
    \Oracle\MIDDLE~1\EPMSYS~1\products\FINANC~2\bin\BatchAdmin.xml" batch.schedule
    ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.
    D:\Oracle\Middleware\EPMSystem11R1\products\financialreporting\bin>
    Already i have ANT_HOME =D:\Oracle\Middleware\modules\org.apache.ant_1.7.1 and added to ANT_HOME to the PATH variable. I restarted the system but still i am getting same error.
    Please help me on this.
    Thanks,
    Naresh

    Hi Celvin,
    Thanks for the reply.
    D:\Oracle\Middleware\EPMSystem11R1\products\financialreporting\bin>BatchName
    D:\Oracle\Middleware\EPMSystem11R1\products\financialreporting\bin>ScheduleBatch
    D:\Oracle\Middleware\EPMSystem11R1\products\financialreporting\bin\BatchName.xml ht
    tp://localhost:19000
    D:\Oracle\Middleware\EPMSystem11R1\products\financialreporting\bin>ant -q -f "D:
    \Oracle\MIDDLE~1\EPMSYS~1\products\FINANC~2\bin\BatchAdmin.xml" batch.schedule
    Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\li
    b\tools.jar
         [echo] Batch accepted for scheduling: D:\Oracle\MIDDLE~1\EPMSYS~1\products\
    FINANC~2\bin\Sch-1.xml
    Now i am getting below information when i ran the scheduled batch.
    Why i am getting
    Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\li
    b\tools.jar
    error.How to rectify this problem. How to make to point it to JDK path ? where i need to update ?
    I have already set JAVA_HOME setting to JDK path and updated in the "PATH" variable.
    Thanks,
    Naresh Mopala.

  • DOS batch file

    Hi techies,
    Is there any way we can execute Ms-DOS batch file from a java program.
    Thanks..

    Runtime.exec("cmd /c thebatch.bat");
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Running executable in batch file as administrator when UAC is high

    Hi Team,
    I have a requirement of running executable in batch file by passing the current windows login username as parameters. Below is the content of my batch file:
    cmd /c start setup.exe http://testsite:7001/mobile  %username%  %username%
    But, when the UAC is set high in windows 7 machine, this executable is not running properly, and giving me warnings. And, if I am running the same start command after opening command prompt as administrator, then executable is running smoothly.
    So, is there any way I can run the executable as administrator by giving some options in batch file, when UAC is high?
    I tried runas option, but its prompting for admin password, which we can't provide as users will not know.
    Do we have some option in batch file as 'Run As Administrator' right click option, where it doesn't prompt for password but run the file with admin privilege?
    Thanks,
    Tina Soni

    Hi,
    When using Runas command, you can add a switch option /savecred
    /savecred will make it ask for admin password on the first run only, after that it should be saved
    Yolanda Zhu
    TechNet Community Support

  • Can we run the batch file using simple java application

    Hello sir,
    we want to run the batch file using simple java application. i tried with some example, we run the exe files but not batch file.
    Runtime r = Runtime.getRuntime();
    r.exec("D:\\jboss\\bin\\run.bat");
    My application is server will run when we run the java appliation.
    any suggestion? plz give me the solutions

    yes you can run html file
    WEB.SHOW_DOCUMENT is a built-in that is used in Forms to call URL from a Web Form. It works much like the similar way that a link on an HTML page works and it takes two arguments, one is URL and second one is TARGET, in your case use following.
    WEB.SHOW_DOCUMENT('http://channas.iil.informatics.lk:8890/forms/frmservlet?config=abc.html', '_blank');
    Hope this will work for you
    Abbas

  • How to run batch file using trigger?

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

    >
    the script will be started around 60-70 times a day
    >
    No - as marwim said the script will be executed every time the trigger is fired. And that trigger, depending on how it is written, might be fired several times for the same transaction.
    And if the trigger is fired the script will be executed even if the transaction that caused the trigger to fire issues a ROLLBACK.
    Triggers are non-transactional. You need to clearly define the business rules for when the script should run. Should it run only when the transaction is COMMITTED? Or should it run if the transaction executes even if the transaction performs a ROLLBACK?
    A trigger is the wrong solution for your problem.
    Please clarify what the business rules are that should control the execution of the script.

Maybe you are looking for

  • Printing PDDoc with AFExecuteThisScript() doesn't work after an upgrade from SDK 5 to SDK8

    Hello, I have made an upgrade of my plug-in which was developed with the Acrobat 5 SDK. I upgrade it to Acrobat 8 SDK and my print function doesn't work anymore. Actually I print my document using a javascript trusted function instead the function pr

  • Mac Mini Install

    Hi, I just got my new Mac Mini with the most current wireless keyboard and magic trackpad. I have the Mac Mini connected to my home theater system via HDMI. I'm "initializing" the system, and the first images that appear are the wireless keyboard and

  • Extract Attachment list from FDO3

    Hi Experts How can I extract the attachment list from FD03 and based on the attachment list where can I get the data of change note pad , I have a requirement to extract the change note for the customer by created on as a parameter ie when I highligh

  • Using MS UAM with Intel Macs and Tiger (10.4.6+)

    I oversee 50 macs in a server environment. The servers are windows server 2003. About 40 of the macs are able to change their network password via the MS UAM. The remaining macs are intel 10.4.6 and above or intel leopard machines. Goal: The ability

  • Vivado 2015.2: Simulation and synthesis reverse bit order of std_logic_vector in logical operators

    In both simulation and synthesis the logical operators on std_logic_vector bit-reverse the operands in the result, at least in the case where the result of the expression is passed to a function. I suspect this issue applies to other operators as wel