Eclipse 从文件中读取标准输入 (System.in) [英] Eclipse reading stdin (System.in) from a file

查看:33
本文介绍了Eclipse 从文件中读取标准输入 (System.in)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse 是否可以从文件中读取标准输入?

解决方案

Pure Java

您可以使用一行代码重定向 System.in:

System.setIn(new FileInputStream(filename));

参见

Is it possible for Eclipse to read stdin from a file?

解决方案

Pure Java

You can redirect System.in with a single line of code:

System.setIn(new FileInputStream(filename));

See System.setIn().

Eclipse config

In Eclipse 4.5 or later, the launch configuration dialog can set System.in to read from a file. See the announcement here.

这篇关于Eclipse 从文件中读取标准输入 (System.in)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆