I have some resource bundles packaged in my main jar
widget_en.properties
widget_de.properties
I retrieve a resource bundle based on my de
If you can make two basic assumptions:
1) You have a default resource bundle with no locale, or at least one locale that you know is there.
2) All your resources are in the same location (ie. the same path within a single jar file)
Then you can get the URL for a single resource:
URL url = SomeClass.class.getClassLoader().getResource("widget.properties");
once you have that, you should be able to parse the URL.
If you use commons-vfs, you should be able to convert the URL into a FileObject:
FileSystemManager manager = VFS.getManager();
FileObject resource = manager.resolveFile(url.toExternalForm());
FileObject parent = resource.getParent();
FileObject children[] = parent.getChildren();
// figure out which ones are bundles, and parse the names into a list of locales.
This will save you the trouble of dealing with the complexities of jar: style url's and such, since vfs will handle that for you.