1 Reply Latest reply on Nov 29, 2015 8:37 PM by James Livingston

    Wildfly 8/9 - real path to class

    K. Bachl Novice

      Hi,

       

      I'm trying to migrate an app from Glassfish to Wildfly but I'm failing miserably on a simpel issue. Basically the situation is this:

      foo.bar.xx.Class

      foo.bar.xx.config-file

       

      I now need the real path to reach the config file but the typical Class.getPath wont work - how can I reach that?

       

      Best,

       

      KB

        • 1. Re: Wildfly 8/9 - real path to class
          James Livingston Apprentice

          Using Class.getResource() or Class.getResourceAsStream() is how you are supposed to access resources like that.

           

          Do you want to get the actual filesystem path? There is no guarantee that there is an actual file on the filesystem. You can use getResource() and check whether the resulting URL is a file: URL, but it often won't be.