java - FileSystemNotFoundException: Provider "jndi" not installed -


i have jsp code i'm trying run read lines .java file. directory tree looks this:

| webcontent  - | resources  - - | foobar.java (the file need read it's lines)  - jspfile.jsp (where i'm running code)  

my code:

string.join("\n", (string[])files.readalllines(paths.get(getservletcontext().getresource("/resources/foobar.java").touri()), charset.defaultcharset()).toarray()); 

whenever try run error:

java.nio.file.filesystemnotfoundexception: provider "jndi" not installed     java.nio.file.paths.get(unknown source) 

i have no idea means , i'd love help

thanks all, wound using code:

public string readresource(string resource){         try{             bufferedreader in = new bufferedreader(new inputstreamreader(getservletcontext().getresourceasstream("/resources/"+resource)));         string line = null;          string data = "";         while((line = in.readline()) != null) {             if(data!="")data+="\n";             data+=line;         }         return data;         }catch(ioexception e){             return "";         }     } 

it works great!


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -