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

Filer.createResource ignores relative directory without explicit -d option

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 6
    • core-libs

      It has been reported that Filer.createResource will ignore the relative directory unless an explicit -d option is used:

      http://forum.java.sun.com/thread.jspa?threadID=5240999

      My annotation processor tries to create an output file called META-INF/persistence.xml in the classes output directory (i.e. -d option to javac). So, I wrote following code:

      final FileObject fo = processingEnv.getFiler().createResource(
      StandardLocation.CLASS_OUTPUT, // -d option to javac
      "",
      "META-INF/persistence.xml",
      null);


      This works as long as I pass -d option to javac. e.g., if I invoke:
      javac -d . Foo.java
      it creates ./META-INF/persistence.xml. But, if I invoke
      javac Foo.java
      it creates ./persistence.xml; where is my META-INF directory gone?

      Sahoo

            darcy Joe Darcy
            darcy Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: