5 Replies Latest reply on Sep 19, 2016 8:59 AM by J I

    Retrieving Path Information

    jfisherdev Novice

      I have a directory under my WildFly home directory that I would like to define a path for and to be able to retrieve at runtime. I am running a WildFly 9.0.2 server in standalone mode.

       

      The directory structure looks like this:

       

      WILDFLY_HOME [jboss.home.dir]

      |

      | - custom

              | - extras

      | - standalone

      ...

       

      I want the path to the "custom/extras" directory to be defined as a relative path to the jboss.home.dir path.

       

      In the standalone.xml, I define a path to the "custom/extras" directory as a path that is relative to the jboss.home.dir path like this:

       

      <paths>
           <path name="custom.extras.dir" relative-to="jboss.home.dir" path="/custom/extras"/>
      </paths>
      

       

      What I want to know is how would I obtain this path information from an application at runtime?

       

      As far as I know, named paths are not inherently registered as system properties, although jboss.home.dir and the other standard named are set as system properties. Ideally the path information would be accessible as a system property so one could do something like this to access path information:

       

      void someMethod(){
           ...
           final Path extrasPath = Paths.get(System.getProperty("custom.extras.dir"));
           ...
      }
      

       

      I would appreciate any information regarding whether or not it is possible to do this or if there is a better method to obtain this information.