简体   繁体   English

如何引用资源包?

[英]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. 我正在创建Java GUI,并希望使用资源包将所有SQL查询存储在.properties文件中。 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: 我用于加载资源束的类位于src / main / java文件夹中的包中,.properties文件位于src / main / resources文件夹中:

在此处输入图片说明

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");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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