我正在尝试加载属性文件,但我一直收到此错误:
线程“main”中的异常java.util.MissingResourceException:不能 找到基本名称D的包:\ bdtej04694 \ Mis documentos \的NetBeansProjects \ SMS_Clientes_Menores \ DIST \ LIB \ help.properties, locale es_VE at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322) 在java.util.ResourceBundle.getBundle(ResourceBundle.java:721)
我正在尝试制作这个
private static PropertyResourceBundle slInfo = null;
//and in another method i'm doing this
String directory = System.getProperty("user.dir");
slInfo = (PropertyResourceBundle)ResourceBundle.getBundle(directory+"\\dist\\lib\\help.properties");
//I put it on a different folder, just in case i want to make changes in the connection strings inside the properties files, without build the project again in netbeans
我在网上搜索(显然,在这个页面中),但我找不到适合我的问题的
提前致谢
答案 0 :(得分:0)
它似乎你的属性文件的路径有问题
D:\bdtej04694\Mis documentos\NetBeansProjects\SMS_Clientes_Menores\dist\lib\help.properties
尽量避免在属性文件的路径中留出空间,这里有一个错误的文档
关于你评论:
改变你的路径如下
String tempPath = directory+"\\dist\\lib\\help.properties";
String finalPath = tempPath.replace("\\", "/");
并使用此finalPath