简体   繁体   中英

How to reference resource bundle?

I am creating a Java GUI and want to use a resource bundle to store all of my sql queries in a .properties file. My class for loading the resource bundle is in a package in the src/main/java folder where the .properties file is in the src/main/resources folder:

在此处输入图片说明

I keep getting a missing resource exception. What am i missing?

Other similar questions say to add the folder to the build path, which it is: 建立路径

This is my call to get the resource bundle:

在此处输入图片说明

删除.properties文件扩展名以形成正确的基本名称,如官方ResourceBundle指南所示

ResourceBundle rb = ResourceBundle.getBundle("dominiondatabase");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM