I published a lite version of Json ResourceBundle to my dormant git repository. Here is a Readme.md copy from that


Registering a custom ResourceBundle.Control extension forces JSON parser jars to be present in extension directory. This repo provides basic skeleton/raw code to overcome the limitation and support json bundle, natively using SPI and extension mechanism. If you are ok with putting 3rd party parser jars in java.ext.dir too (or putting your extension in default ext directory), then you don’t need to look further in this git.

Load your json bundle.

java by default provides way to load a ResourceBundle using ResourceBundle.getBundle(..) api. The default implementation supports a java and properties file ResourceBundle.

A typical usage of API, is explained in java doc:

ResourceBundle myResources =
      ResourceBundle.getBundle("MyResources", currentLocale);


ResourceBundle myResources =

ResourceBundle myResources = ResourceBundle.getBundle(“MyResources”, currentLocale);

The API supports java|properties bundle by default. And java also provides way to control other bundles. e.g json or xliff.

A very well documented tutorial to register own ResourceBundle.Controland to take over discovery and creation of bundle exist here.

However the problem I faced with this approach is that to register the ResourceBundle.Control the SPI implementation jar has to be in java.ext.dir dir. To quote the tutorial:

When you install a Java extension, you typically put the JAR file of the extension in the lib/ext directory of your JRE. However, this command specifies the directory that contains Java extensions with the system property java.ext.dirs.

So far so good. Steps are :

  1. You register a service implementing java.util.spi.ResourceBundleControlProvider,
  2. return a custom implementation of ResourceBundle.Control
  3. override public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)
  4. Place the jar in ext directory, or change the ext directory and your bundle is loaded.

🚫 Problem

Problem is in step 3. To create a new JsonBundle, we will have to parse Json file. Most of the JSON Parser (GSON/Jackson/..) are third party libary and this approach will force those 3rd party libraries to be present in ext folder. Reason for this is the ext/dir is loaded using extension classloader unlike your system classloader. And hence the depdendent API for parsing JSON has to be there in extension directory. I tried to solve it using another SPI that provides parsed bundle.

  1. build project json-resourcebundle-ext and put the jar in the default ext dir or keep a note of folder where you have placed the jar.
  2. Run the test in json-resourcebundle by specifying -Djava.ext.dir=<path_where_jar_created_in_1_above>.
  3. For netbeans user, there exists nbactions.xml in json-resourcebundle. Define env variable USER_LOCAL_REPOSITORY to point to your local maven repository and things shall work