Reputation: 329
I'm trying to use FileReader on Mac. I've created a FileReader as:
FileReader reader = new FileReader("~\\Documents\\workspace\\ProjectAMChart\\amcharts_3.11.1.free\\amcharts\\amcharts.js");
But for some reason, I always get a FileNotFoundException
. How am I supposed to enter the proper file path on a Mac?
Upvotes: 0
Views: 841
Reputation: 86774
Two problems:
~
is a shell metacharacter. Use the user.home
system property instead.i.e.
String userHome = System.getProperty("user.home");
FileReader reader = new FileReader(
userHome +
"/Documents/workspace/ProjectAMChart/amcharts_3.11.1.free/amcharts/amcharts.js");
Upvotes: 2
Reputation: 960
You should be using single forward slashes not double backslashes.
EX: "/Documents/workspace/ProjectAMChart/amcharts_3.11.1.free/amcharts/amcharts.js"
Upvotes: 0