Opening a dos window

how can i open a dos window from java and putting a code in it to run?
thnaks in advance
peleg

Hi,
No. You can't do it in a platform independent way. But you can open a shell on linux/unix, so you have to first detect OS, and then execute the correct method.
/Kaj

Similar Messages

  • Open a DOS window

    Wanting to open a DOS window and also open a DOS window that will automatically start the Windows version of FTP. Have tried:
    Runtime DOS = Runtime.getRunTime();
    DOS.exec("command.com");
    however window does not appear. Any help would be appreciated.
    Thanks,
    Bart

    I appreciate the suggestion, however when I add the wait command the application just sits with nothing appearing, i.e. the DOS prompt window. Like I said earlier, I can replace the cmd.exe with any Windows app (such as Word, Excel, Notepad, etc.) and it works, It is just the stinking DOS prompt Window by itself I can not get to show. Idea? -Thanks
    WORKS:
    try{
    String ss = "notepad.exe";
    Runtime DOS = Runtime.getRuntime();
    DOS.exec(ss);
    }catch(IOException io){}
    DOES NOT WORK:
    try{
    String ss = "cmd.exe";
    Runtime DOS = Runtime.getRuntime();
    DOS.exec(ss);
    }catch(IOException io){}

  • Exec opens a DOS window !!!!

    Hi,
    I'm launching in a loop an external program with the following command:
    Process p=Runtime.getRuntime().exec( S9XMLDMP + "S9xmldmp.exe -d" + '"'+RepertoireXML+'"' + " " + '"'+ChemFic+'"' );
    p.waitFor();
    that command is launched almost 3000 times consecutively and for each time, a DOS window opens and close immediately
    I want to display a jprogressbar, but for that I don't want the DOS windows to open, I want the job to be made as it was before, but without the opening /closing of the windows ? Is it possible with the runtime command ? please, how can I do ?
    thank you very much
    L.

    I don't know if this will help, but in one case I was
    using exec and noticed that if I used javaw.exe to launch
    my app (no dos window) then my subprocesses would each open a dos window, but if I used java.exe to launch
    my app they wouldn't.
    Keith Ambrose

  • Runtime.exec open new DOS Window

    Hi,
    I want to execute a program (a.exe) having as work directory (C:\geo\B\)
    I create a batch file for changing into the directory and executing the command in the way:
    cd C:\geo\B
    start a.exeThis batch file (art.bat), I execute it in the following way within the run method of a Thread:
      public void run() {
          Process proc = Runtime.getRuntime().exec("cmd /K start " + art.bat);
          proc.waitFor();
          proc.destroy();
       }The fact is that works fine, but with this execution it opens a DOS window and i would prefer to avoid the appearance of new windows.... any help??
    Thanks All,
    Al

    cmd always opens a dos window - use another console interpreter instead or just call the programm directly.
    i.e.
    Runetime.exec("c:\\myprogram.exe");

  • Opening a DOS Window and Linux Terminal

    Can some tell me how to open a DOS Window and Linux/Unix Terminal window from within a Swing application using Runtime.getRuntime() (or whatever is correct). I've tried (for Windows 2000):
                   Runtime rt = Runtime.getRuntime();     
                   Process pr = rt.exec(command);
    But it does not work.
    Thanks

    Ok.. I figured it out for Windows:
    cmd /c start cmd.exe // windows 2000
    Does anyone know the similar command on Linux/Unix to opening a terminal window.
    Thanks

  • DOS window for sm_authority.exe opens on starting HP OpenView

    I have this problem: when opening the HP Open View open a DOS window opens. Apparently I have no problems with the window to minimize or close, but it is an open unwanted window. I noticed that there is a record of bug related to this problem, Bug ID CSCsa97997 but i did not use the patch because the LMS 4.0.1. Does anyone have a solution here?I have this problem: when opening the HP Open View open a DOS window opens. Apparently I have no problems with the window to minimize or close, but it is an open unwanted window. I noticed that there is a record of bug related to this problem, Bug ID CSCsa97997 but i did not use the patch because the LMS 4.0.1. Does anyone have a solution here?

     Sometimes it helps to  prepare  the hdd  with Cyberlink Utility cd first. Download and Save the file. Once download is complete, put a blank cd in your drive and click the file to create a boot cd. Boot with this cd and wait until you get a green check mark indicating hdd is ready. Remove the cd , insert first Recovery Disk and restart the laptop.
    http://ftp.hp.com/pub/softlib/software11/COL32372/pv-80183-1/sp44645.exe
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • How would I print information to a DOS window?

    Ok so I can get the DOS window running by using this code:
          try{
                       Runtime rt = Runtime.getRuntime();
                       Process child = rt.exec("cmd.exe /c start cmd.exe");
                       child.waitFor();
                   }catch(IOException io){}
                   catch(InterruptedException e) {}but I want to print the information from this code:
    StringBuffer objectString = new StringBuffer("");
    ////some code here//////
    objectString = new StringBuffer(("Customer:\t\t" + customerName + "\n"
                               + "Departure Date:\t" + departureDate + "\n"
                               + "Return Date:\t" + _returnDate));
    ////some code here/////
    objectString.append("\nAirline:\t\t" + airlineBG.getSelection().getActionCommand());
    objectString.append("\nDestination:\t" + destinationBG.getSelection().getActionCommand());
    /////more code. yay//////
    objectString.append("\nPrice:\t\t" + price);
    objectString.append("\nTicket Bought. Have a safe flight!");
    System.out.print(objectString.toString());//print string bufferso how would I print objectString to the DOS window?
    Note: opening the DOS window is in the constructor for the JFrame I am using while printing the StringBuffer is in the actionPerformed implementation.

    masijade. wrote:
    deadmanwalkin wrote:
    no, the program im supposed to be making asks to print ticket information to a DOS window.
    I might have interpreted it wrong and it could be just start from a DOS window using the java File commandWell, study your assignment text. If it does not explicitly state that you must programmatically open a new "DOS window", then simply print your output using System.out.println().Unless he's running Windows 95 still he can't even open a DOS window as there's no more DOS ;)

  • Invoke command in new dos window

    is there any way that i can invoke a command in a new dos window from java application?
    such as
    runtime.exec("dir");
    it will open another dos window, and run dir in it.
    thanks

    it will open another dos window, and run dir in it.This works for me (win 2000):
    Runtime.getRuntime().exec("cmd /c start dir");

  • Running executables in a DOS window

    I'm in a bind that I think has two possible solutions.
    What I need to do is get an exe running. Normally, when you double click on it, it opens up a DOS window and runs in that. If I use Runtime.getRuntime().exec(), then the app runs invisibly, which is not good (for testing).
    On top of this problem, one I have the app open I need to navigate through the menu system as if someone were actually sitting there typing. There are no APIs defined for interaction with the program.
    I think one possible solution is to use Runtime.getRuntime().exec() to run a batch file that will open the program. However, if I use this approach then I will need to detect the newly running GUI so I can "type" into it, possibly using the Robot class.
    Another solution is to have Java open a DOS window itself and run the program from inside of it. This seems like it would be more straightforward because I would have all the handles necessary for interacting with the window, again with the Robot class.
    I can't find any information on working with Dos apps through Java, and I'm not sure which, if any, of these approaches is feasible. Does anyone have any advice?

    no, the apps don't run "silently" when you use
    Runtime. Instead, the Process object gives you
    access to their input and output streams.
    Essentially giving you the Dos console that you're
    e used to programatically. You can write to and read
    from its streams in any manner you like.Thanks Brent. Unfortunately for me, the app I'm using doesn't output anything java's input stream can read. It's one of those old graphical menu kind of interfaces.
    The other reason that I'd like to run it graphically is that I would be able to see what my program is doing while I'm debugging it. Since I have to do things like press "down arrow" it would be a lot easier to use the Robot class than to tell Java to send those sequences across.

  • DOS Window automaticly close after execute the batch file and start the App

    Hi, all. I have made a batch file. When I start the batch file, thet is getting open the DOS Window. But I want close the DOS Window after Start the Application, or make it hidden?
    It is possible?
    Thanks all:-)
    Nikolay

    Hi,my batch file is:
    java -cp File.jar Desktop
    I have tryaed with:
    javaw -cp File.jar Desktop , but it dosn�t close the DOS Window.
    Have I make anythink false?
    Thanks.
    Nikolay

  • Closing DOS window

    I have a bat that looks like this everything works
    start javaw -jar Runner.jar
    but is there anyway to make the dos window close...
    i thought javaw was supposed to run without the dos window...
    or is my dos window a result of -jar
    thanks for anyhelp
    Scott

    I did some testin on my win2000 machine, and running a batfile with the line
    start C:\jdk1.3.1_01\bin\javaw.exe -jar jarfile.jar
    gives just a quick flash of a dos window before it closes again, and my java application starts. The same works for jsdk1.4.1_01. The only way I have found to not have the dos window close automatically is to remove the "start" part of the command, in which case the window stays open as long as the application runs and then terminates. So I don't really know what causes your problem.
    When you start a bat file Windows open a dos window. When to close that again is basically up to Windows, not the programs running in it. So I think it's question of telling Windows to behave, and not the javaw command as such. I seem to remember that the properties dialog for shortcuts to dos commands in winXP have a checkbox for something like "leave dos window open", but I'm not sure.
    What does your dos window look like? - Does it "hang" on the javaw command, or do you get a new prompt you can write to?

  • Hiding DOS window

    When i run my program from the java command, the java.exe opens a DOS window (besides my java program) and it won't close or hide it. And if i close this DOS window, it closes my java program too. How do i hide this DOS window, so it'll only appear my java program?
    Victor.

    Use javaw.
    Actually you could create an executable jar. If you state in your manifest file where the main method is, if your using Windos, it will lookup in your Reg what the assioated program is and javaw will run it without a prompt.
    try reading this.
    http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html

  • How do you prevent MS-DOS window from appearing during Runtime.exec()?

    The question below was attached to the answer for Question of the Week No. 21. I'm having the same problem. Does anyone know the answer? Put another way does anyone know how javaw does it?
    Fri Dec 18 09:59:52 PST 1998
    rkarasek
    On Windows NT 4.0, how can I prevent CreateProcess()
    from creating a cmd.exe window when using javaw and
    Runtime.exec()? No such cmd.exe window is created if
    instead I run "java" from the command line.
    I have a C++ server named "foo", and have created
    a Java applcation with Swing GUI named "foo.java".
    This GUI captures configuration information and
    then uses Runtime.exec() to start the C++ app, with
    a socket established between the Java app and C++
    app for later communication.
    This is all working fine, and the Java application
    and GUI working as expected. When I run "java foo"
    from either the NT command shell (cmd.exe) or MKS
    Korn shell (sh.exe) the Java application/GUI starts,
    and when it calls Runtime.exec() my C++ process is
    started as what appears to be a child process of the
    "java" process, that is, no cmd.exe window is created
    during the Runtime.exec("foo.exe") call.
    However, when running the same Java application from
    a shortcut on the desktop via "javaw", when I invoke
    Runtime.exec() a cmd.exe window is created before my
    C++ server is started. While things are running
    ok and my Java app can still communicate with my
    C++ server, is there anyway I can prevent this
    cmd.exe window from being created, and instead, have
    my C++ server run as a child process of javaw (or
    an independent process without a cmd.exe)?

    cmd always opens a dos window - use another console interpreter instead or just call the programm directly.
    i.e.
    Runetime.exec("c:\\myprogram.exe");
    OR
    The following demonstrates executing a command without bringing up a popup. import java.io.*;
    public class Test {
      public static void main (String args[]) throws IOException {
        String[] command = {
          "C:\\winnt\\system32\\cmd.exe", "/y", "/c",
          "dir"};
        Process p = Runtime.getRuntime().exec(command);
        InputStream is = p.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        BufferedReader br = new BufferedReader(isr);
        String line;
        while ((line = br.readLine()) != null) {
          System.out.println(line);
    }However....
    According to bug number 4244515 in Sun's Bug Parade (http://developer.java.sun.com/developer/bugParade/bugs/4244515.html), javaw doesn't always work without bringing up new window.

  • FRM-10142 The Http Listener (Dos Window Does not Stay Open)

    Dear Sir
    URGENT
    When I start OC4J instance its dos window open for few seconds and after that its closed.
    I mean OC4J instance dos window des not staying open at task bar.In oracle 10g forms builder and 11g database
    Please guide me how this problem would be solve...?
    Yassen

    For URGENT questions go right to https://support.oracle.com and file a Prio 1 SR with Oracle Support. For everything else I don't see why your question is more urgent then others.
    Did you check if maybe the port OC4J runs on (8889) is already used by another program (netstat)? Did you check the logfiles?
    cheers

  • Call x.exe and write command in opened DOS window

    Hi,
    I am using Labview 10 and Window 7. Just wondering how to use labview to
    1. run x.exe under opened DOS window?
    2. write command in opened DOS window?
    Any commends welcome,
    Thanks,
    Ott

    Please take a look here
    Alejandro | Academic Program Engineer | National Instruments

Maybe you are looking for

  • Selection of BOM and Routing in Cost estimate

    Hi I have an issue with the cost estimate run. We are using CK40n for cost estimate. The selection method in MRP 4 is defined as 3 (only by prod version) and the version indicator is maintained in the costing views also. When we run the cost estimate

  • Fan control out of control in Windows 7 (x64)

    Hi, Anyone noticed that the fan control is not working correctly when running Windows 7 (x64) in Boot Camp? Under heavy load (100%) on both cpu cores, the thermal protection circuit actually kicks in due to the CPU cores reaching temperatures of 104

  • Shared Components Images Create Image does not work

    I am using oracle XE on Windows XP. Uploading an image for an application does not work. Home>Application Builder>Application 105>Shared Components>Images>Create Image It goes wrong when I try to upload the image: - Iexplorer gives an error 404 after

  • I cannot clear history without clearing cookies with Safari 8.0

    I have the new Safari 8.0 with OS X Yosemite. I can not clear history without also clearing cookies. With Maverick it was possible to clear history and keep cookies, not now. This is NOT an improvement! Is there a way to keep cookies and clear histor

  • Adobe Media Core error while installing itunes

    I fixed an MSVCR80.dll error but when I tried to reinstall iTunes, I got an Adobe Media Core error for CS6.  Now itunes won't install at all.  It doesn't save the installer, although the site acts as if it's already downloaded.  Can anyone help with