System.out. 输出到指定文件中
2016-07-11 00:00
323 查看
用下面的方法,就可以输出到指定文件中了
String strJSON = "这是一段字符串,这段字符串将会打印到指定文件中。";
//日志输出到指定文件中
PrintStream out;
try {
out = new PrintStream("C://Users//whr-pc//Desktop//classpath//img//Systemout.txt");
System.setOut(out);
System.out.println(strJSON);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String strJSON = "这是一段字符串,这段字符串将会打印到指定文件中。";
//日志输出到指定文件中
PrintStream out;
try {
out = new PrintStream("C://Users//whr-pc//Desktop//classpath//img//Systemout.txt");
System.setOut(out);
System.out.println(strJSON);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
相关文章推荐
- Maven项目怎样引用其他项目/或者jar包
- 史上最全Vim快捷键键位图(入门到进阶)
- 项目管理: Maven 让事情变得简单
- 自定义单点登录(2)
- 浏览器跨域问题 jsonp
- nginx修改端口后,访问项目报错404
- 对Spring 及SpringMVC的理解
- 解释spring,struts,hibernate优缺点
- ajax不执行异步方法,直接执行error回调函数
- JSON 中的毫秒时间( LONG) ,转换成年月日
- github sshkey
- eclipse中设置java虚拟机内存
- Java CRC32的用法
- blob clob区别
- poi导入excel
- 关于纹身
- jstl根据字符串进行判断
- 随笔
- Meta标签中的viewport属性及含义
- 单点登录3