I am trying to have the server read from a file called "config.txt" in the same directory as the main .html file during the war.
In posting mode, I can easily access the file using the Scanner object:
Scanner s = new scanner ("config.txt");
But this does not work during deployment, as the file paths are slightly different. How can I get the correct file path to access config.txt in the deployed version?
I tried getServletContext.getRealPath ("config.txt"), but for some reason I get a Null Pointer exception when trying to call this in the ServiceImpl constructor ...
source
share