You cannot get the physical location from the ResourceBundle , but if you know the path that was used to download it, you can find out its physical location. Like this:
String resourceToLoad = "file"; URL url = this.getClassLoader().getResource(resourceToLoad); ResourceBoundle bundle = ResourceBundle.getBundle(resourceToLoad);
url will have the physical location of the resource - at least most of the time.
Remember that a ResourceBundle can also be supported by the Java class, rather than something like a property file. ClassLoader.getResource does not understand the correspondence between ResourceBundle and Java classes. If you want to support them, you will have to implement a similar algorithm for what the ResourceBundle does to look for classes that fit this pattern.
source share