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

Switch "-Duser.dir" breaking the working dir for classpath argument

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u301
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10
      java version "1.8.0_301"
      Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
      Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)



      A DESCRIPTION OF THE PROBLEM :
      The switch "-Duser.dir" doesn't set the working dir for the "-cp" argument and breaks it.
      Using a relative path is sometimes necessary since only ANSI arguments are supported.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      For this file structure on Windows 10 :
          %APPDATA%\MyApp
              lib
                myapp.jar


      This works:

          pushd "%APPDATA%\MyApp"
          java -cp "lib\*" myapp.Main


      but this fails with a ClassNotFoundException when "user.dir" is set :

          pushd "%TEMP%"
          java -Duser.dir="%APPDATA%\MyApp" -cp "lib\*" myapp.Main


      It also fails with a ClassNotFoundException with the correct working dir but a different "user.dir" :

          pushd "%APPDATA%\MyApp"
          java -Duser.dir="%TEMP%" -cp "lib\*" myapp.Main


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The switch "-Duser.dir" should either set the working dir for the classpath or not break it.
      ACTUAL -
      Not only "-Duser.dir" does not set the working folder for "-cp",
      it also breaks the loading of classes when "-cp" contains a relative path.

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: