I am trying to read an xml configuration in the below class.It is Working when Running It .But When i Export it into a Runnable Jar.The file is not being read ..??
 public KeyTranslator() {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                String sPath = "res/config.xml";
     //InputStream is = (InputStream) Thread.currentThread().getContextClassLoader().getResourceAsStream(sPath);
    //InputStream is = this.getClass().getResourceAsStream((sPath);
                try {
                        DocumentBuilder builder = factory.newDocumentBuilder();
                        if (AppFrame.jar == null) {
                                this.myDoc = builder.parse( new File((AppFrame.basePath+sPath).replace('\\', '/')) );//ensure seperator is '/' as linux is picky
                        } else {
                                this.myDoc = builder.parse(AppFrame.jar.getInputStream(AppFrame.jar.getJarEntry(sPath)));
                        }
            }
I googled & found the getResourceAsStream method.But it seems to throw FileNotFoundException.& i Don't know how to add InputSream in my Code ???
So Help me in the Right Direction :)
Thanks for your Help ...
Note The Method i Tried has been Commented
 
     
     
    