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

File.getAbsolutePath() is incorrect if "user.dir" is set on the command line

XMLWordPrintable

    • generic, x86
    • generic, linux, windows_nt, windows_2000, windows_xp

      While the user set uer.dir in command line, then the File initialed with an relatively directory will occur a problem:

      That is, If you get it's AbsolutePath, it relate on the dirctory which user defined. but when you test if this file exist, the related directory is still where the javaVM been setup.

      Name: skT88420 Date: 12/07/99


      C:\gcs\serverconnect\src\org\objectweb\jonas\tools>java -version
      java version "1.2"
      Classic VM (build JDK-1.2-V, native threads)

      Hi;

      We need to set the default directory for some java tools we call (that are not
      our code). We have found the following:

      1) user.dir returns the default directory.

      2) If you set user.dir in a program - it has no effect.

      3) If you set it on the command line, it only half works.

      3a) This call gives you the directory you set: new File ( fileName).getAbsoluteFile ( )

      3b) This call uses the original default directory - not user.dir: newFileInputStream ( fileName )

      I think this is a bug - ???

      - dave
      (Review ID: 98747)
      ======================================================================

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: