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

IllegalArgumentException: path too long for directory fm.setLocationFromPaths(StandardLocation.SYSTEM_MODULES,classes)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:

      Description

      Create directory "classes" with exploded module m
      modules/m/module-info.class
      modules/m/p/D.class

      invoke fm.setLocationFromPaths(StandardLocation.SYSTEM_MODULES,classes);

      Exception will be thrown
      java.lang.IllegalArgumentException: path too long for directory
      at com.sun.tools.javac.file.Locations$SystemModulesLocationHandler.setPaths(jdk.compiler@9-internal/Locations.java:1377)
      at com.sun.tools.javac.file.Locations.setLocation(jdk.compiler@9-internal/Locations.java:1548)
      at com.sun.tools.javac.file.JavacFileManager.setLocationFromPaths(jdk.compiler@9-internal/JavacFileManager.java:807)

      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
              StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
              Path modules = base.resolve("modules");
              Path classes = Files.createDirectories(base.resolve("classes"));
              tb.writeJavaFiles(modules.resolve("m"), "module m { }", "package p; public class D { }");
                  tb.new JavacTask()
                          .options("-modulesourcepath",modules.toString())
                          .outdir(classes)
                          .files(modules.resolve("m/p/D.java"))
                          .run();
                  fm.setLocationFromPaths(StandardLocation.SYSTEM_MODULES,classes);

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jjg Jonathan Gibbons
                Reporter:
                anazarov Andrey Nazarov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: