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

    Wildfly 8/9 - real path to class

    kbachl

      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
          jameslivingston

          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.