ResourceBundle in Java 9 Module

Mandy Chung mandy.chung at oracle.com
Mon Apr 3 17:27:45 UTC 2017


I created a JBS issue:
  https://bugs.openjdk.java.net/browse/JDK-8177980

What platform are you running on?  This works on linux but I can reproduce the problem on OSX (related to case-insensitive file system).

Mandy

> On Apr 3, 2017, at 8:54 AM, Rabea Gransberger <rgransberger at gmx.de> wrote:
> 
> Hello,
> 
> while migrating example code to Java 9 Modules I ran into a problem:
> 
> ResourceBundle bundle = ResourceBundle.getBundle("de.rgra.nl.messages");
> System.out.println(bundle.getString("I18n.message"));
> 
> The properties file path is:
> src\de\rgra\nl\messages.properties
> 
> The code works on Java 8 and 9 when used on the Classpath.
> 
> It fails in Java 9 when used in a module on the Modulepath with:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> de/rgra/nl/Messages (wrong name: de/rgra/nl/messages)
> 
> Changing it to uppercase M will work on Classpath and Modulepath
> (without changing the properties file to uppercase M):
> 
> ResourceBundle bundle = ResourceBundle.getBundle("de.rgra.nl.Messages");
> System.out.println(bundle.getString("I18n.message"));
> 
> Can anybody explain to me why this happens?
> 
> The example with run script can be found at:
> https://github.com/rgra/java9-module-refactoring/tree/master/resourcebundle
> 
> 
> 
> ---
> Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
> https://www.avast.com/antivirus
> 



More information about the jigsaw-dev mailing list