Help! problem running .bat files in browser

HI! Hope you can help me!
I have a simple applet that runs .bat files and retrieves the resulting information into a text box.
To run those files I use:
Runtime rt = Runtime.getRuntime();
Process processo=rt.exec("C:/po2PrtMonitor.bat 04600105 ope >C:/infoPrt.txt");
in wich "04600105","ope" and ">C:/infoPrt.txt" are parameters that the .bat file is expecting. When the file is ran it saves the resulting information on a simple .txt file, that I later read by using:
fichResposta = new FileInputStream(fichRespostaPath[0]);
When I run my applet on JDeveolper 9.0.2.822 is works perfectly, the problem is when run it on the browser.
On the browser the applet executes the file by opening a MS-DOS prompt and when it finishes executing the file, the prompt closes automatically and doesn't send the information into the .txt file.
My .bat file is something like:
jre -cp PrtSrv20.jar sibs.deswin.prt.PrtMonGateway 10.46.1.22 5003 %1 %2 %3
where %1,2%,3% are the above parameters given by the applet when the file is ran.
If I run it on JDeveloper I get:
C:\>jre -cp PrtSrv20.jar sibs.deswin.prt.PrtMonGateway 10.46.1.22 5003 04600105 ope
PRTSES=04600105 HDR=0460010000000005 STA=OPENED TRF=ACTIVE TRP=CONN ILTS=15 Long postings are being truncated to ~1 kB at this time.

Here is what is missing:
ILT=0 MSQ=388 HDR=04.60.01.00.00.00.00.05.41.00.01.84. CMD=STRT-TRF
When the applet is run on the IE broser what I get is simply:
jre -cp PrtSrv20.jar sibs.deswin.prt.PrtMonGateway 10.46.1.22 5003 04601005 ope
I have no idea as to what the problem might be! Do native methods work differently on the browser?! Could it be a problem on the deployment? A library not included on the deployment profile? Suggestions are very welcome.
Hugo Rosas

Similar Messages

  • Problems running bat file with calls to java programs (.jar)

    I created a bat file with calls to jar programs. In each line,
    I put a call to the programs with parameters, but bat only
    executes the first line and ends execution.
    All lines of my bat file must be executed.
    What should I do?
    Best Regards,
    Pedro Felipe
    [http://pedrofao.blogspot.com|http://pedrofao.blogspot.com]
    [http://viajantesmundo.blogspot.com/|http://viajantesmundo.blogspot.com/]

    user8730639 wrote:
    I realized that the problem isn`t my bat file. I made tests calling another jar files and then all the lines of the batch file were executed. So, the jar file called on my previous bat is finnishing the execution. I verified and the jar apps worked without error.
    I would like to know if exists any command in Java that can cause this effect (close a batch), to modify the open source code of the application.Not that I know of.
    Is prism a bat file?
    If you are invoking bat files from your bat file without using call that would explain it
    :: mymain.bat file
    :: call the first bat file
    call prism.bat arg1 arg2 arg3
    :: call the other bat file
    call prism.bat arg4 arg5 arg6
    ::

  • Running Bat file in Minimized Mode

    Hai All,
    I need to run bat file using Runtime, Bat file should run in minimized
    mode ...
    any one help me
    Regards
    Yuva

    Assuming it's windows...
    start /min mybatchfile.batOpen a command prompt and type "start /?" to see the params available.
    regards,
    Owen

  • Java virtual machine error: in running bat file!!!

    Hi experts!
    I have encounterd a problem . Could not figure out why I am having this. I hope at least I will get a clue /suggestion from any of you.
    I am creating a bat file from my java Application. Then I double click on the newly created bat file to run that. It gives me Java virtual machine launcher error:" could not find the main class, Progam will exit". I have a VB script, that also create the same bat file. but I dont have problem running that file manually. Even if I create the bat file manually(by typing), it ran well. It shows the error mesage only when I create bat file from my java Application. Instead of running the bat file manually, I tried to run it through my java application too(by Runtime.exec() ). But it shows me the same error msg.
    Why am I getting java virtual machine launcher error when I tried to run my bat file that is created from java Application? ANy clue? Please suggest me about how to resolve this.
    Regards

    Probably because (despite what you say) the contents of the bat file created by your Java application aren't the same as the contents of those other bat files.Yes contents are same. I create the bat file from my java Application. then I am trying to run that bat file manually. It gives me the specified error. But if I create the bat file manually (with the same content) and then run it manually. It works well.
    Any clue/suggestion

  • Running bat files in java code

    Hi,
    I am trying to run a .bat file within java code like this.
    Runtime.getRuntime().exec("c:\\Test.bat");
    but no success. Could you please suggest how to run .bat file or simply a
    DOS command from java code.
    thanx in advance
    Deepak Garg.

    try this...
    n reply whether it worked or not......
    import java.util.*;
    import java.io.*;
    import java.net.*;
    try
    Runtime runtime = Runtime.getRuntime();
    Process process ;
    process= runtime.exec("./temp_install");
    //code to print command line replies
    InputStream stderr = process.getInputStream();
    InputStreamReader isr = new InputStreamReader(stderr);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while((line=br.readLine())!=null)
    System.out.println(line);
    catch(Throwable t)
    t.printStackTrace();
    }

  • How to write run.bat files

    Can anyone tell me how to write run.bat files to run java classes. Currently my run.bat file has the following two lines,
    c:\j2sdk1.4.1_02\bin\javac.exe *.java
    c:\j2sdk1.4.1_02\bin\java.exe questionnair
    But the class is not executed. Thanks in advance.

    you'll have to provide more details.
    Firstly, which package is the class a part of? and secondly, where on the filesystem is the root of the package?
    You might also benifit from placing the c:\j2sdk1.4.1_02\bin\ into the classpath.
    On a rainy day, check out the ANT tool, it will take care of all that crapola for you.
    newio

  • Scheduled task won't run .bat file

    Hi. On Windows Server 2008 I have a scheduled task that calls a .bat file. The fist step in the .bat file is write to a log file to the same directory in which the .bat file exists. This allows me to find out if it is ever run. When the .bat file is run from a command prompt it runs as expected writing to the log file and completing its actions. My problem is that when I run the scheduled task manually or allow it to run when scheduled it appears to run but the .bat file is never run. No log file is ever created. The History tab in the properties of the scheduled tasks shows the task being started and running then completing with an operation code of 2. I've disabled the UAC for the user account. I've set the task to run as the Administrator user and verified the permissions for that user. I know the password is correct for the task because I can make changes to the properties and save those changes with the username/password. I'm at a loss for further troubleshooting steps. Can anyone point me in the right direction to figure out why these .bat files are not being run? 

    So I had this problem, I double clicked on the .bat and notepad opened the .bat.  I ran through this whole long and very absorbing thread of this forum.   I wanted to save the entries that were most helpful, so I copied and pasted into
    a notepad document (.txt)  I could not find a way to attach it here, so I copied and pasted that below. I called it a synopsis....  Did I spell that right?
    As you can see, I added my experience at the top (A and B).  The stuff I copied is noted with the original author. This is the first time I posted anything to these here microsoft forums, although I have been telling computers what to do for 40+ years. 
    So hope I did not break any social protocols here.
    ==================================== Begin ====================================
         Running A Dot Bat File in Windows Server 2008 Vista 7 etc and beyond V01
    ============================================================================
    This was created as a synopsis of the entries at the following forum location:
    http://social.technet.microsoft.com/Forums/en/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe
    A) manually
         This is an opinion added by Thomas Rock
        1) Open a command window (that would be cmd.exe)
        2) In the command window navigate to the directory containing the .bat file and it's dependents
               ex...  C:\Program Files (x86)\Bobs\Your\Uncle
        3) Run the .bat file by typing the name including the .bat extension (in the command window of course)
                 TheBatFile.bat
           Note: Using this method, the .bat file will run in the current command window directory (the directory where the .bat file is located)
                             (this is the key for getting it to run in the task scheduler... Start in folder option)
    B) The double click
                This is an opinion added by Thomas Rock
         1) Using Windows exlporer, find the .bat file
         2) use the mouse or other device to double click on the .bat file
         3) if it does not run (in my case the wordpad application opened the .bat file)
              a) make sure that the .bat file extension is associated with the program c:\windows\system32\cmd.exe
              b) make sure the profile you are using has rights to run the cmd.exe
              c) make sure the profile has the rights to the directories, the .bat and any other objects used or affected by the .bat file processing.
    C) As a task using task scheduler
         Proposed As Answer by Brian Vandemark Wednesday, September 02, 2009 9:36 PM
    1) Make sure that the task is set to "configure for Windows Vista or Windows 2008" on the first page of the task properties (under the "general" tab)
    2) Make sure that the task is set to "start in" the folder that contains the batch file:
          a) open the task properties
          b) click on the "actions" tab
          c) click on the action and then the "edit" button at the bottom. 
          d) In the "Edit Action" Window there is a field for "start in (optional)" that you set to the path to the batch file.
          e) be sure to include an end backslash for the start in path "C:\dir1\dir2\"    (the last backslash is not optional)
    3) Make sure that the task is running as an account that has explicit "Full access" permissions to all these things:
          a) the .bat file itself
          b) the folder containing the .bat file
          c) the target files/folders that are affected by the .bat script. 
               Note:  Inherited permissions did not seem to work.
    4) Make sure that the account running the task is a member of the local "administrators" group for this machine
    5) Make sure that the task is set to "run whether logged on or not"
    6) Tick the box "Run with highest privileges".    
           Note: Point 6 here was from Edson F. Lima Wednesday June 30 2010 1:35 PM
                      The original point 6 was moved to point 7.
    7) The Task should run successfully with expected output when you right-click on the task and select "run" 
            If it does that then it will run successfully when you are logged off.
    D) Still another way as a task using task scheduler
          Proposed As Answer byDarren Wallace Thursday, July 15, 2010 1:41 AM
    This has been bugging me for 6 or 7 months.
    I don't have admin rights to the box and the guy who does is very busy...
    so I've felt the range of emotions mentioned above.
    I tried most everything above as well. But what seemed to get my processes processing, was ...
       • on the General tab, I clicked the Change User or Group button
       • in Select User or Group (first smaller dialog box)  I clicked the Advanced... button
       • in the next Select User or Group (second bigger dialog box) I clicked the Find Now button
       • in the Search results I selected the Administrators (a group) and it returned SERVERname\Administrators into the "Enter the object name to select" entry in the previous dialog box
       • then I clicked OK and returned to the General tab above
       • the options to Run only when user is logged on and Run whether user is logged on or not are no longer available
       • then I made sure that the Run with highest privileges was checked
       • then I clicked OK and during the next scheduled time to run ... it ran
       Note: See note in A) Manually above.
    E) Task scheduler recommendation
         Proposed As Answer byTamusJRoyceThursday, December 01, 2011 3:42 PM
    I have found .bat and .cmd files do not run correctly either.
        My solution:  Don't run the batch file directly. 
           Have TaskScheduler run:  cmd.exe
              with parameter:  /C YourBatchFile.bat
             and start in: C:\SomePath\ (without quotes!) where C:\SomePath\YourBatchFile.bat exists. 
            And then select the radio button for it to run regardless if you are logged in or not.
    Exit errors may not be logged to the Event Log (they weren't when the .bat ran directly from Task Scheduler when I was logged in), so I find it best to manually log your own Event in case a error occurs and you want to send an email.
     REM Logs an event which causes eventlog to send an email when it fails.  Also, "/l application" needs to be lowercase.
    eventcreate /t error /id 203 /l application /d "your logged description."
    And then make a completely separate task with a trigger:  On an event.  Basic Selected.  Log: Application.  Source: EventCreate. Event ID: 203.  And have the action on this task send an email (attaching any generated log files, if needed).
    Hopefully helpful (took me 3 days to figure all this out...gar)
    ===================================== End ===================================
         Running A Dot Bat File in Windows Server 2008 Vista 7 etc and beyond V01
    ============================================================================
     

  • Running bat-files from Java

    Hello,
    I have been trying to launch a bat-file from my Java code, running under windows, but with no success.
    Here is my simple code:
    Runtime.getRuntime().exec(new String[] {
             "C:\\temp\\test.bat"
          });This does nothing at all and generates no exception. Any suggestions?

    It seems java has a real problem with this... if you
    want to run another java program, for instance, you
    cannot do that either with String cmd="cmd.exe /C
    java myProgram"
    I need to pass parameters from one program into the
    program I'm going to open using java, that is why I
    need to call it from my first program. It can open
    executables and shortcuts, but has a real big problem
    doing things with the command line.No it doesn't have a problem with it. You just must be doing something wrong. By the way, since "java(.exe)" is already an executable, there's little value in wrapping that by the "cmd.exe" shell (unless you want to use the command shell for some reason such as passing the redirector (>) symbols to it to let it redirect stdout / stderr to a file)

  • Where is the run.bat file?

    Hi,
    I have downloaded beanbuilder-0_6-alpha from https://bean-builder.dev.java.net/
    I am trying to install the bean builder going thru the readme file. I have extracted all the file but I cannot find "run.bat". Can anyone help me find this file.
    If this is not how I should go about installing the bean builder. Please guide me.
    Thanks,
    tick_tick

    Hi,
    You probably have the wrong classpath on your line:
    java -cp ... javafilename xml ruleset_nameSince the DocumentBuilderFactory can't be found.
    It is most likely included in one of the jar-files in the lib directory.
    /Kaj

  • Run .bat file?

    Alright this won't seem to run my file, what am I doing wrong?
    try {
                String File = "mybat.bat"; // File specified
                Runtime.getRuntime().exec(File);
            } catch (IOException ioe) {
                ioe.printStackTrace();
            } Thanks for any help.
    Edited by: Austin187 on Nov 5, 2008 2:30 PM

    .bat file will run without "/c", but here's what I was talking about
    private static void SlashCTest() {
              while (true) {
                   JFileChooser jf = new JFileChooser();
                   int res = jf.showOpenDialog(null);
                   if (res != JOptionPane.OK_OPTION) System.exit(0);
                   File f = jf.getSelectedFile();
                   Runtime r = Runtime.getRuntime();
                   //String cmd = f.getAbsolutePath();
                   String cmd = "cmd.exe /C \"" + f.getAbsolutePath() + "\"";
                   try {
                        Process p = r.exec(cmd);
                        InfoFetcher fetcher = IOUtils.loadData(p.getInputStream());
                        FetcherListener fl = new InfoFetcher.ToStandardOut();
                        fetcher.addFetcherListener(fl);
                        new Thread(fetcher).start();
                        fetcher = IOUtils.loadData(p.getErrorStream());
                        fetcher.addFetcherListener(fl);
                        new Thread(fetcher).start();                    
                   }catch (IOException ex) {
                        ex.printStackTrace();
         }Edited by: tjacobs01 on Nov 5, 2008 11:39 PM

  • Run .bat file with arguments?

    Hi,
       I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like
    Eg : test.bat parameter1 parameter2
    var myFile=new File("c:\\test.bat");
    myFile.execute();
    The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.

    Hi,
    let VB start the *.bat. this works for me:
    #target InDesign
    doTheBat('START "" "C:\\Program Files\\Adobe\\Adobe Photoshop CS5.1 (64 Bit)\\Photoshop.exe"')//Start Photoshop, just a example
    function doTheBat ( _data ) {  
            try 
                var _file = new File('~/myTmpBat.bat'); 
            _file.open( 'w' );  
            _file.encoding = 'UTF-8';  
        _file.writeln ( _data );  
        _file.close();  
        //_file.execute(); 
        myVBScript = "Set WshShell = CreateObject(\"WScript.Shell\")\r"; 
    myVBScript += "WshShell.Run chr(34) & \"C:\\Users\\%USERNAME%\\myTmpBat.bat\" & Chr(34), 0\r"; 
    myVBScript += "Set WshShell = Nothing\r";
    myVBScript += "\r"; 
    app.doScript(myVBScript, ScriptLanguage.VISUAL_BASIC);
        }catch (e){  alert(e);
    Good luck
    Hans-Gerd Claßen

  • Run .bat file from Flex

    Hi,
    I'd like to execute a .bat file from Flex. I thought this piece of code should work but no luck
    fscommand("Exec", "C:\\Sandbox\\doSomething.bat");
    Can someone please point me in the right direction?
    Thanks in advance,

    Sandbox does not allow external apps to be run in Flex apps. AIR 2.0 may have this.
    If this post answered your question or helped, please mark it as such.

  • Problem running swf file outside dev environment

    If I copy my bin-debug folder outside the dev environment
    i.e. any where in hard disk and run the html file the swf is unable
    to connect to the HttpService.
    Is there any way to solve this problem.. Its working fine
    when i am running it from inside of flex builder bin-debug dir.
    "Crossdomain.xml" is also provided.
    Thanks

    This is probably due to security restrictions of running a
    file on your local machine that access network resources. Try
    running the SWF file via a network request and not opening it as a
    file (use the
    http:// protocol rather than file:// in your
    browser).
    matt horn
    flex docs

  • Problem running .exe files

    I cannot run .exe files on Windows 10. A pop-up window shows a message that the .exe file I am trying to run is missing. What can I do to solve this problem ?

    Keep in mind that the Win 10 build "refresh" operations are clearing parts of the registry back to default values, so some things you've installed might end up uninstalled or only half installed after an upgrade to a new TP build.
    What EXACTLY is going wrong?  In other words, exactly what are you trying to do, and what is the exact content of the message(s) you're seeing.
    Details matter.
    -Noel
    Detailed how-to in my eBooks:  
    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

  • Running .bat files

    Hello,
    I recently uninstalled my Google Chrome to then reinstall it. Ever since, I have .bat files that used to open in Windows Explorer that now open new tabs in Google Chrome. How do I stop that from happening? I want the .bat files to open in Windows Explorer
    just like before. I already tried adding the batfile zip folder (that you guys created) in the registry and no change.
    Thanks in advance for the help.

    Could you please tell us the function of these .bat files? What application are these .bat files will launch? I suggest you check the default "open method" of these applications.
    Click Control Panel>Default Program, then set your default programs.
    Regards
    Yolanda
    TechNet Community Support

Maybe you are looking for