PrintWriter FileNotFoundException
来源:互联网 发布:js获取一个对象的长度 编辑:程序博客网 时间:2024/05/22 03:19
scala写入文件:
val percentPath="test/percent.txt"val bw = new PrintWriter(new FileWriter(percentPath))//val bw = new PrintWriter(new FileWriter("test/percent.txt"))bw.write("test" )bw.close()
在集群上运行时报异常:FileNotFoundException ,然后网上看到https://stackoverflow.com/questions/11496700/how-to-use-printwriter-and-file-classes-in-java,修改代码为:
val file = new File("test/percent.txt")file.getParentFile().mkdirs();val bw = new PrintWriter(file)
运行后代码依然报异常:FileNotFoundException ,后来把File()中传的文件路径改为linux路径,这样代码就没问题了,原来File(path)中的path必须是本地路径,填写hdfs路径会报异常。
阅读全文
0 0
- PrintWriter FileNotFoundException
- PrintWriter
- PrintWriter
- PrintWriter
- PrintWriter
- PrintWriter
- printwriter
- PrintWriter
- PrintWriter
- FileNotFoundException
- filenotfoundException
- FileNotFoundException
- FileNotFoundException
- FileNotFoundException
- StringWriter/PrintWriter
- StringWriter/PrintWriter
- [Java] PrintWriter
- PrintWriter类
- GET重定向url带特殊字符参数拼接问题的解决
- Git忽略规则及.gitignore规则不生效的解决办法
- 如何为新添加硬盘并建立文件系统,分区
- 李奎元:说说那些征信模型(Z计分模型、巴萨利模型和A值模型)
- 【Linux】-- Mysql(2) : 创建数据库和数据表
- PrintWriter FileNotFoundException
- 排序算法速度比较
- python 迭代器与生成器即迭代协议的特别说明
- 微信扫描二维码登录第三方平台
- Hibernate中如何使用count(*)取得表中记录总数
- 2. Add Two Numbers
- 第四章 Linux常用命令(文件操作)
- Linux链接文件之软连接硬链接
- Android静默安装(需root)