java.util.MissingResourceException: Can't find bundle for base name 'property_file name', locale en_US

后端 未结 9 1848
失恋的感觉
失恋的感觉 2020-12-09 07:30

I am trying to create a utility class ReadPropertyUtil.java for reading data from property file. While my class is located under a util directory , my sky

9条回答
  •  自闭症患者
    2020-12-09 08:23

    I'd like to share my experience of using Ant in building projects, *.properties files should be copied explicitly. This is because Ant will not compile *.properties files into the build working directory by default (javac just ignore *.properties). For example:

    
        
            
            
        
        
            
        
    
    
    
        
    
    

    Please notice that 'copy' section under the 'compile' target, it will replicate *.properties files into the build working directory. Without the 'copy' section the jar file will not contain the properties files, then you may encounter the java.util.MissingResourceException.

提交回复
热议问题