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

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){}

  • 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

    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

  • Executing WINWORD from both Windows and linux using Java

    Dear All,
    I have a problem when trying to use Runtime class to execute a winword document. My code is as follows.
    Runtime r= Runtime.getRuntime();
    try{
    r.exec("rundll32"+" "+"url.dll,FileProtocolHandler"+" "+"WINWORD"+ " "+"file://C://welkom.doc");
    catch(Exception ex){
    System.out.println("Unable to open the doc file:"+ex);
    When I execute this swing application with the above, the program is unable to open the specific file. And it says "Problem with the short cut, unable to open the file". When I run the program without the file name, it opens a new doc file.
    Attn: what I want to do here is I need to open the winword file from both windows and linux. So I cannot use the relative path of the WINWORD.exe file.
    Can anyone help me?
    Thanks in advance.
    Regards,
    Bala

    If you take a look at the api, there's an exec(String[]) method. This is the one you should use when calling a command with multiple parameters.
    so something like...
    String[] cmd = new String[] {"rundll32", "url.dll,FileProtocolHandler", "WINWORD", "file://C://welkom.doc"}
    r.exec(cmd);

  • 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

  • Differences on Windows and Linux JVM about java.util.zip package

    Hello, there!
    I need some help if someone else has already face this problem.
    I have a Java server that process the bytes of a SWF File stored in the server and ouptut it to the user through a Servlet. The file was decompressed and re-compressed using the java.util.zip package (Deflater/Inflater).
    Everything works fine on Windows Server 2008 server. But now we need to migrate the server to Linux. The problem is that when I test the website now, the file seens to be corrupted.
    What really intrigues me is that everything runs normal on Windows Server configuration, when changed to Linux, the final file seens to be corrupeted... what could possible be the cause? Is there any difference between java.util.zip package on Window and Linux JVM?
    My Windows Server is:
    . Windows Server 2008 (6.0 - x86)
    . Apache 2.2.11
    . Tomcat 6.0.16.0
    . Java JDK 1.6.0_12-b04
    My CentOS Server is
    . CentOS 5.4 (2.6.18-164.15.1.el5 - i386)
    . Apache 2.2.3
    . Tomcat 6.0.16.0
    . Java JDK 1.6.0_12-b04
    Please, if someone could give me a lead, I would appreciate very much!
    Thank you all in advance,
    CaioToOn!

    ejp wrote:
    Thank you for the answer, but no. The path is correct.That's not what he meant. Zip file/directory entries are supposed to use / as the path separator. It is possible to use \ but such Zip files will only work under Windows. You may have erred here.Ohhh, I had really missunderstood what Ray said. But, I still think that this is not the problem, since the ZIP is a single SWF file generated by Flex SDK 3.4 and compressed in the ZLIB open standard (as in page 13, at [http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf|http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf] ). This is how Flash Compiler compress the files.
    jschell wrote:
    If the above suggestions do not solve the problem...Specify in detail with the exact steps used how you determined that it was corrupted.The reason why I believe the SWF is getting corrupted is that when it is loaded by Flash Player (in the client-side) the Player throws a VerifyError: Error # 1033. The [documentation says (see error 1033)|http://help.adobe.com/en_US/AS3LCR/Flash_10.0/runtimeErrors.html] that this error means that the SWF file is corrupted.
    As I said, what intrigues me is that this work perfectly in a Windows Server 2008 server. I just had setup a CentOS server and deployed the application. The client-remains unchanged, so why could the result change?
    raychen wrote:
    I would remove the side effect you are doing and send the file straight through, with decompress and compress, the servlet. It is more likely that you have a bug in your swf processor than the zip library.
    I had already tried it when first coding, in Windows Server 2008, it had not worked.
    Thank you all for the help.
    CaioToOn!

  • When I try open a .pdf file my Adobe Reader 11 only allows the download / save opening the related window and don't show me both options 1) open with ... and 2) save as.... probably someone flagged the choise... always perform this way ....

    When I try open a .pdf file my Adobe Reader 11 only allows the download / save opening the related window and don't show me both options 1) open with ... and 2) save as.... probably someone flagged the choise... always perform this way ....
    Could some one give help and let me know where I can probably find the settings option that allows me to change and switch to previous situation where it was possible to decide time to time how to proceed either opening the file or saving it ??
    Thanks in advance
    David

    What is your operating system?
    Open a PDF from where?  If online, in what browser?

  • When I open a separate window and start private browsing my main window closes and I lose all of my app tabs

    whenever I open a new window and do private browsing it closes my main window and I loose all of my app tabs. If this is functioning as designed then it is a flaw in the design.

    It is designed that way. When you stop private browsing, all of your other tabs will come back.

  • When I am NOT private browsing Firefox will not allow me to delete or change the website address in the location bar. My only remedy is to open a new window and search in google then click the link to that site through google. How can I resolve this?

    Question
    When I am NOT private browsing Firefox will not allow me to delete or change the website address in the location bar. My only remedy is to open a new window and search in google then click the link to that site through google. When I swap to private browsing firefox allows me to anter the website address directly into the location bar - but this is a slow [prcess to swap back and forth - also by dint of using private browsing I loose my website information.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Error message after update "Safari cannot open a browser window and may be

    My daughter just did an update and got the following error message: "Safari cannot open a browser window and may be missing important resources. Try installing Safari again.
    Any thoughts or tips as to what happened?

    Just a few pieces of clarifying information... This is Safari on OS X you're talking about, right? Also, what update did your daughter install? Have you tried reinstalling Safari (you can download it from Apple's site)?

  • I have a number of tabs opened in a window and i have grouped them.Is there any add-on or extension so that i can hide it or secure it or lock that tab group ?

    My laptop is being shared by others...so when others open the firefox page they can see all the tabs opened in a window or a tabgroup.i want o hide the tabgroup or secure tha tabs in a window by creating a passoword so that the others dont get the chance to view the tabs that i was browsing and so they have to open a new window and thus all the information in my tabs is safe and still are open even if they close their new window after their browsing.

    hello, when you're using a shared computer a better option would be to create separate (password-protected) windows accounts for each user - then each one would have her/his own firefox profile...
    http://windows.microsoft.com/en-US/windows7/User-accounts-frequently-asked-questions

  • Open a command window and send some keystroke to the opened command window

    Hi All,
    I am trying to open command prompt and send some key stroke to that command prompt. Here I am using Robot to send keystroke. But the problem is, the keystrokes are not sent to the prompt. I guess I need to activate progamitically the command prompt to accept the keystrokes . Please find the code below ( as I did).
    try
    String command = "cmd.exe /c start";
    Process child = Runtime.getRuntime().exec(command);
    Robot robot = new Robot();
    Thread.sleep(5000);
    String lol = "indranil";
    for(int i=0;i<lol.length();i++)
    robot.keyPress(lol.charAt(i));
    int g = lol.length() - 1;
    robot.keyRelease(lol.charAt(g));
    catch (Exception e) {}
    I guess I am doing some mistake here while sending the keystroke/openning the command prompt. Can anyone please help me how can I open a command window and send some keystroke to the opened command window. I am in fix.
    Thanks,
    Indranil

    The first thing to do is read the API and examples for the Robot class.
    Also check out this thread with a similar discussion: [http://forums.sun.com/thread.jspa?threadID=5385677]
    The short spoonfed answer - keyPress() and keyReleaseI() do not take chars. Read up on KeyEvent

  • File Path for Windows and Linux

    hi can any one give solution how to implement code for odi file copy .
    i am using Same Code for Windows and Linux
    OdiFileCopy "-FILE=#Var_Lookup_File_Path \ Employee.csv" "-TOFILE=#Var_Lookup_File_Path_Backup\Employee.csv" "-RECURSE=NO" "-OVERWRITE=YES" "-CASESENS=NO"
    the problem of above code is
    it is working in windows but my Prod is Linux environment.
    in linux \ not works.. / will work
    please suggest how to concatnate variable and file without' \' '/'

    Thanks Phani
    i think in OS command also we may give path like #variable\File Name.
    So how it will replace \ with / in Linux.
    Could you give code for my Scenario..
    Thanks for helping

  • Oracle10G and oracle11gr1 for windows and Linux

    Hi
    Can you help me in getting these Softwares
    Oracle10G and oracle11gr1 for windows and Linux ,I am unable to get them .
    Thanks in advance
    Sanjeev Sen

    Oracle10G NOT SUPPORTED ANYMORE,NO SOFTWARE AVAILABLE TO DOWNLOAD TOO
    oracle11gr1 for windows and Linux > http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

Maybe you are looking for