I have tried all possible ways to rad file but all are giving same error.No matter what way i try, code is unable to find the file. Please help.
Asked
Active
Viewed 237 times
0
-
Move your `word.txt` to `resources dir` , then do `val f = new File(getClass.getClassLoader.getResource("word.txt").getPath)` – Rohan Khude Oct 24 '16 at 05:05
-
1@Aman Kaushik: Try with `\\\` instead of `/` in the file path. – Shankar Oct 24 '16 at 05:11
-
Please post code, not screen images. That makes it much easier to plug your code into a working IDE and test it. – jwvh Oct 24 '16 at 05:52
-
Thanks Shankar.It worked. – Aman Kaushik Oct 24 '16 at 06:13
-
Thanks Rohan and jwvh. Thanks for responding. – Aman Kaushik Oct 24 '16 at 06:13
-
1@Shankar Please post your comment as answer as it worked for OP – sag Oct 24 '16 at 08:40
-
@AmanKaushik: If its working, please accept the answer. Thanks sag. – Shankar Oct 24 '16 at 09:08