java - forward slash in file path causing issues. File contents are not read. Gives "The system cannot find the path specified." error -
how handle forward slash in file path. requirement read contents of csv file. giving
string filename = "mynewfile.csv"
converting /
\
. operating system windows. using rad ide. using file.separator
didn't help. giving me the system cannot find path specified.
error.
tried this:
inputstream = sampleclass.class.getclassloader().getresourceasstream("mynewfile.csv"); bufferedreader br = new bufferedreader(new inputstreamreader(is));
and this:
the moment try escape /
\/
ide shows me compilation error invalid escape sequence (valid ones \b \t \n \f \r \" \' \\ )
tried moving file directly under project(moved out src folder) , changed code br = new bufferedreader(new filereader(csvfile));
still seeing the system cannot find file specified.
error
can please ???
sampleclass.class .getclassloader().getresourceasstream( "com/xyz/abc/" + mynewfile.csv);
you can use above give package name where csv located
Comments
Post a Comment