Results 1 to 2 of 2
  1. #1
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default Windows command shell

    Hello everyone.

    I have implemented a file service that transmits files via TCP/IP. I have written a method that downloads the specified file to the windows temporary directory. However, the command shell does not always open the file for some reason. The file is definitely downloaded correctly. Also, it seems that the problem is more common on XP than with Vista. Here is the code that does the work with the shell:
    Java Code:
        
        public static void readDocument(JFrame caller, Document document) throws Exception {
            String outputDir = System.getProperty("java.io.tmpdir");
            String filename = document.getDocShortName();
            String path = outputDir + filename;
            // download document
            (new FrmManageDocuments()).downloadDocument(caller, document, path);
            // open document
            Process process = Runtime.getRuntime().exec("cmd /c \"" + path + "\"");
            
        }
    Please let me know if you can see any problems with this code fragment.

    Thank you ;)
    Tim
    Last edited by tim; 10-06-2009 at 06:44 PM.
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  2. #2
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default

    Any suggestions, anyone?
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

Similar Threads

  1. Need some help with a copy command in a shell
    By Hekmat in forum New To Java
    Replies: 5
    Last Post: 04-27-2009, 12:00 AM
  2. how to run windows command prompt in java parogram ?
    By indikasampath2000 in forum AWT / Swing
    Replies: 4
    Last Post: 12-16-2008, 07:51 AM
  3. Bean Shell
    By Bisweswar in forum Advanced Java
    Replies: 2
    Last Post: 08-16-2008, 01:36 AM
  4. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •