简体   繁体   English

找不到资源包

[英]Can't find resource bundle

I'm trying to load a properties files, but i keep getting this error: 我正在尝试加载属性文件,但我不断收到此错误:

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name 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) at java.util.ResourceBundle.getBundle(ResourceBundle.java:721) 线程“main”中的异常java.util.MissingResourceException:无法找到基本名称D的包:\\ bdtej04694 \\ Mis documentos \\ NetBeansProjects \\ SMS_Clientes_Menores \\ dist \\ lib \\ help.properties,java.util.ResourceBundle.throwMissingResourceException中的locale es_VE (ResourceBundle.java:1499)at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322)at java.util.ResourceBundle.getBundle(ResourceBundle.java:721)

I'm trying to making this 我正在努力做到这一点

    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

I searched on the web (and obviously, in this page), but i can't find an aswer to fit my problem 我在网上搜索(很显然,在此页面中),但找不到适合我的问题的方法

Thanks in advance 提前致谢

its seems you have problem with path of you properties file 它似乎你的属性文件的路径有问题

D:\bdtej04694\Mis documentos\NetBeansProjects\SMS_Clientes_Menores\dist\lib\help.properties

try to avoid space in path of properties file, you have one here Mis documentos 尽量避免在属性文件的路径中留出空间,你在这里有一个Mis documentos

regarding you comment : 关于你评论:

change your path like below 改变你的路径如下

String tempPath =  directory+"\\dist\\lib\\help.properties";
String finalPath = tempPath.replace("\\", "/");

and use this finalPath 并使用此finalPath

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

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