Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4129773

Runtime.exec() can't set the working directory

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.1.5
    • core-libs
    • generic
    • generic



      Name: dm26566 Date: 04/16/98


      It is impossible to write a application launcher
      in 100% pure java. Many external programs
      require the current working directory to be
      set to something specific. Currently, the only
      way to accomplish is to create a proprietary
      native library.

      Java should have a function such as:
      Runtime.exec(String cmd[], String env[], File cwd)
      which uses cwd as the working directory for the
      new process.
      (Review ID: 28456)
      ======================================================================
      phil.race@eng 1998-04-17

      An API call like

      public Process exec(String cmdarray[],
                          String envp[],
                          File directory) throws IOException, FileNotFoundException

      would be pretty easy to implement I think

      On Solaris this can be implemented by doing a chdir() after the fork()
      and before the exec()

      On win32 the CreateProcess() system call takes an optional parameter
       to set the working directory.

      Implementing this would probably answer the needs of at least some
      of the requestors of the more contentiosu RFE 4045688


      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            dmcduffisunw Dale Mcduffie (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: