<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fetch1.com &#187; Running system command through Java</title>
	<atom:link href="http://fetch1.com/tag/running-system-command-through-java/feed" rel="self" type="application/rss+xml" />
	<link>http://fetch1.com</link>
	<description>Priyank Maniar&#039;s Weblog on Blogging, Programming, Windows, Technology and other stuff.</description>
	<lastBuildDate>Thu, 21 Jan 2010 23:49:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Running system command through Java</title>
		<link>http://fetch1.com/running-system-command-through-java/111</link>
		<comments>http://fetch1.com/running-system-command-through-java/111#comments</comments>
		<pubDate>Wed, 16 Sep 2009 16:20:41 +0000</pubDate>
		<dc:creator>fetch1</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Running system command through Java]]></category>

		<guid isPermaLink="false">http://fetch1.com/?p=111</guid>
		<description><![CDATA[Running system commands through Java Try the below code (for Linux OS) &#38; you&#8217;ll get the listing of files &#38; folders from current directory If you want to open &#38; close CD rom infinitely, Just replace &#8216;ls&#8217; command with the cd ROM opening cmd Also for CD ROM closing &#8230;. Enclose them in infinite loop [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Running system commands through Java</strong></p>
<p>Try the below code (for Linux OS) &amp; you&#8217;ll get the listing of files &amp; folders from current directory</p>
<p>If you want to open &amp; close CD rom infinitely,<br />
Just replace &#8216;ls&#8217; command with the cd ROM opening cmd<br />
Also for CD ROM closing &#8230;. Enclose them in infinite loop &#8230; thats all&#8230;&#8230;</p>
<p>(You have to maintain a boolean flag for open &amp; close)</p>
<p>try {</p>
<p>Process p = Runtime.getRuntime().exec(&#8220;ls&#8221;); //Line to talk with H/W</p>
<p>BufferedReader stdInput = new BufferedReader(new<br />
InputStreamReader(p.getInputStream()));</p>
<p>BufferedReader stdError = new BufferedReader(new<br />
InputStreamReader(p.getErrorStream()));</p>
<p>// read the output from the command</p>
<p>System.out.println(&#8220;Here is the standard output of the command:\n&#8221;);<br />
while ((s = stdInput.readLine()) != null) {<br />
System.out.println(s);<br />
}</p>
<p>// read any errors from the attempted command</p>
<p>System.out.print(&#8220;Here is the standard error of the command (if any): &#8220;);<br />
while ((s = stdError.readLine()) != null) {<br />
System.out.println(s);<br />
}</p>
<p>System.exit(0);<br />
}<br />
catch (IOException e) {}</p>
<script type="text/javascript" class="owbutton" src="http://onlywire.com/button" title="Running system command through Java" url="http://fetch1.com/running-system-command-through-java/111"></script><h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://fetch1.com/how-to-zoom-in-or-zoom-out-in-a-browser/30" title="How to Zoom in or Zoom out in a Browser?">How to Zoom in or Zoom out in a Browser?</a></li><li><a href="http://fetch1.com/how-to-make-an-autorun-file-for-cd/55" title="How to make An Autorun file for CD?">How to make An Autorun file for CD?</a></li><li><a href="http://fetch1.com/worlds-most-smallest-batch-virus/44" title="World&#8217;s Most smallest Batch Virus">World&#8217;s Most smallest Batch Virus</a></li><li><a href="http://fetch1.com/how-to-enhance-the-sounds-and-music-on-your-desktop/158" title="How to Enhance the Sounds and Music on your Desktop/Laptop ?">How to Enhance the Sounds and Music on your Desktop/Laptop ?</a></li><li><a href="http://fetch1.com/websites-to-submit-blogswebsites/74" title="A List of Websites Where you can submit your blogs/websites">A List of Websites Where you can submit your blogs/websites</a></li><li><a href="http://fetch1.com/tips-for-buying-used-monitor/89" title="Tips for Buying used Monitor">Tips for Buying used Monitor</a></li><li><a href="http://fetch1.com/how-to-remove-the-description-from-wordpress/7" title="How to Remove the Description from Wordpress?">How to Remove the Description from Wordpress?</a></li><li><a href="http://fetch1.com/how-to-make-a-folder-delete-protected/57" title="How to make a folder delete protected?">How to make a folder delete protected?</a></li><li><a href="http://fetch1.com/why-servlets-are-server-extensions/109" title="why servlets are server Extensions ?">why servlets are server Extensions ?</a></li><li><a href="http://fetch1.com/pros-and-cons-of-adbrite/125" title="Pros and Cons of Adbrite.">Pros and Cons of Adbrite.</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://fetch1.com/running-system-command-through-java/111/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
