I have this code to read a txt file for Series 40
The problem is that gives me the following error:Code:private void ReadTxt() { String thisLine=""; try { InputStream is = this.getClass().getResourceAsStream("/src/res/txt/myFile.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); while ((thisLine = br.readLine()) != null) { //System.out.println(thisLine); lstOpera.append(thisLine, null); } br.close(); is.close(); } catch (Exception e) { e.printStackTrace(); } }
What can I do to make this working?Code:C:\Work_java\SMSDcs\src\dcs\elo\sms\SMSDcs.java:866: cannot find symbol symbol : class BufferedReader location: class dcs.elo.sms.SMSDcs BufferedReader br = new BufferedReader(new InputStreamReader(is)); C:\Work_java\SMSDcs\src\dcs\elo\sms\SMSDcs.java:866: cannot find symbol symbol : class BufferedReader location: class dcs.elo.sms.SMSDcs BufferedReader br = new BufferedReader(new InputStreamReader(is)); 2 errors C:\Work_java\SMSDcs\nbproject\build-impl.xml:174: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 2 seconds)
Another question that I have is if I can read a txt file outside a jar, i.e., without compiling a both jar and txt (present in resources) together???
-----
Thank's for the help

Reply With Quote

