【发布时间】:2022-01-23 01:59:30
【问题描述】:
当我尝试使用 scala 读取文件时,它不起作用,但在这个位置我有文件
这是权限问题
scala> val loc = "C:\\Users\\gvenk\\OneDrive\\Desktop\\Input\\accountdetails.txt"
loc: String = C:\Users\gvenk\OneDrive\Desktop\Input\accountdetails.txt
scala> Source.fromFile(loc, "UTF-8").getLines().toList
java.io.FileNotFoundException: C:\Users\gvenk\OneDrive\Desktop\Input\accountdetails.txt (The
system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStr
【问题讨论】:
-
它是否以某种方式
Source.fromFile-特定?(new java.io.File(loc)).exists()也说存在吗?
标签: scala