TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Java 9 Process API

22 点作者 javinpaul超过 8 年前

2 条评论

carsongross超过 8 年前
Everything Wrong With Java, the example:<p><pre><code> try { Process p = Runtime.getRuntime().exec( System.getenv(&quot;windir&quot;) + &quot;\\system32\\tasklist.exe&quot;); BufferedReader input = new BufferedReader( new InputStreamReader(p.getInputStream())); String line = null; while ((line = input.readLine()) != null) { System.out.println(line); &#x2F;&#x2F;If line describes a correct process, &#x2F;&#x2F;reformat the string to get your information out here. } input.close(); } catch (IOException ioe) { ioe.printStackTrace(); } </code></pre> This should read:<p><pre><code> println( System.exec( &quot;tasklist.exe&quot; ) ); </code></pre> Yes, there should be a stream interface to the output, yes there should be a more complicated mechanism for working with processes in an object oriented manner, but c&#x27;mon guys: most of us just want to execute a command and screw with the string output.
评论 #12415169 未加载
评论 #12415103 未加载
评论 #12414979 未加载
评论 #12417430 未加载
malcolmgreaves超过 8 年前
The JVM needs structs so badly. New libraries are not what&#x27;s necessary. Fixing a design flaw is! &#x2F;rant
评论 #12415760 未加载