ResourceBundle in Java 9 Module
Rabea Gransberger
rgransberger at gmx.de
Mon Apr 3 15:54:06 UTC 2017
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