Well-formed URLWindows:
file:///d:/props/errmsg.properties
MacOS:
file:///props/errmsg.properties
Linux:
file:///props/errmsg.properties
file:///d:/props/errmsg.properties
MacOS:
file:///props/errmsg.properties
Linux:
file:///props/errmsg.properties
Load Resource from different location
// Load resource from specific file object
File f = new File("d:\\\\props\\res.jar");
URL url = f.toURI().toURL();
URL[] urls = new URL[]{url};
URL url = f.toURI().toURL();
URL[] urls = new URL[]{url};
ResourceBundle lang = ResourceBundle.getBundle("tw.com.mycomp.res.properties", new Locale("en", "US"), new URLClassLoader(urls));
// Load resource from specific URL
URL[] urls = new URL[]{ new URL("file:///d:/props/errmsg.properties") };
ResourceBundle lang = ResourceBundle.getBundle("tw.com.mycomp.res.properties", new Locale("en","US"), new URLClassLoader(urls));
ResourceBundle lang = ResourceBundle.getBundle("tw.com.mycomp.res.properties", new Locale("en","US"), new URLClassLoader(urls));