1 Reply Latest reply on Feb 16, 2012 12:20 PM by bosschaert

    OSGI bundle absolute path

    spandit2

      Hello experts ,

       

      I am trying to get an absolute path of a file in my bundle , so that I can deleted that file . However I am not getting absolute path and I do not know how to get one .

       

      I can load the resource using this.getClass().getClassLoader().getResource() .

       

      However the URL from this resource shows me path

       

      bundle://AppEntryValidationBundle-47-0-0/config/listenerconfig.xml

       

      Is there any easy way to get the absolute path ?

       

      I have also tried bundle.getEntry

       

      I would appreciate any help .

       

      Thanks

      Sunil

        • 1. Re: OSGI bundle absolute path
          bosschaert

          Hi Sunil,

           

          The OSGi specification does not mandate that the bundle contents need to exist anywhere on disk or that there is an API that provides the actual location on disk. While you might find a way to figure out where these are located on disk, this solution will be non-portable.

           

          However if you want to get rid of the bundle, you can call Bundle.uninstall() and PackageAdmin.refreshPackages(null) the framework, which will remove the bundle from the framework.

           

          Best regards,

           

          David