<?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>Der Blog von Benny Neugebauer</title>
	<atom:link href="http://www.bennyn.de/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bennyn.de</link>
	<description>Alles über die Informatik &#38; Co.</description>
	<lastBuildDate>Fri, 27 Jan 2012 12:16:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Div Element horizontal und vertikal zentrieren</title>
		<link>http://www.bennyn.de/programmierung/css/div-element-horizontal-und-vertikal-zentrieren.html</link>
		<comments>http://www.bennyn.de/programmierung/css/div-element-horizontal-und-vertikal-zentrieren.html#comments</comments>
		<pubDate>Fri, 27 Jan 2012 12:16:14 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[horizontal]]></category>
		<category><![CDATA[vertikal]]></category>
		<category><![CDATA[zentrieren]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3140</guid>
		<description><![CDATA[Ein Code sagt mehr als tausend Worte: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;meta charset=&#34;utf-8&#34; /&#62; &#60;title&#62;Centering a Div horizontally and vertically&#60;/title&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Ein Code sagt mehr als tausend Worte:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!</span>DOCTYPE html<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>meta charset<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;utf-8&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Centering a Div horizontally and vertically<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>style type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">&gt;</span>
      html
      <span style="color: #009900;">&#123;</span>
        background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span> black<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      body
      <span style="color: #009900;">&#123;</span>
        width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">%;</span>
        height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">%;</span>
        position<span style="color: #339933;">:</span> static<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* don't make it relative! */</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">#centered
</span>      <span style="color: #009900;">&#123;</span>
        position<span style="color: #339933;">:</span> absolute<span style="color: #339933;">;</span>
        height<span style="color: #339933;">:</span> 396px<span style="color: #339933;">;</span>
        width<span style="color: #339933;">:</span> 400px<span style="color: #339933;">;</span>
        margin<span style="color: #339933;">:</span> <span style="color: #339933;">-</span>198px 0px 0px <span style="color: #339933;">-</span>200px<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* 50% height, 0px, 0px, 50% width */</span>
        top<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">%;</span>
        left<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">%;</span>
        background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span> violet<span style="color: #339933;">;</span>
        border<span style="color: #339933;">:</span> 1px solid white<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #339933;">&lt;/</span>style<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>  
    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;centered&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/css/div-element-horizontal-und-vertikal-zentrieren.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript AMD Example with RequireJS</title>
		<link>http://www.bennyn.de/programmierung/javascript/javascript-amd-example-with-requirejs.html</link>
		<comments>http://www.bennyn.de/programmierung/javascript/javascript-amd-example-with-requirejs.html#comments</comments>
		<pubDate>Wed, 25 Jan 2012 14:09:18 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[Module]]></category>
		<category><![CDATA[requirejs]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3131</guid>
		<description><![CDATA[One line of code is worth ten thousand words. ./index.html &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;meta charset=&#34;utf-8&#34; /&#62; &#60;title&#62;Asynchronous Module Definition Example with RequireJS&#60;/title&#62; &#60;/head&#62; &#60;body&#62; &#60;!-- Let's use RequireJS as module loader (there are also others!) --&#62; &#60;script src=&#34;./js/require-1.0.4.js&#34;&#62;&#60;/script&#62; &#60;script&#62; require(['js/my_amd_module'], // Requires ./js/my_amd_module.js function(myModule) { myModule.sayHello(); myModule.doSomething(); }); &#60;/script&#62; &#60;/html&#62; ./js/my_amd_module.js define&#40;'js/my_amd_module', // module [...]]]></description>
			<content:encoded><![CDATA[<p>One line of code is worth ten thousand words.</p>
<h2>./index.html</h2>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot; /&gt;
    &lt;title&gt;Asynchronous Module Definition Example with RequireJS&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;  
    &lt;!-- Let's use RequireJS as module loader (there are also others!) --&gt;
    &lt;script src=&quot;./js/require-1.0.4.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
      require(['js/my_amd_module'], // Requires ./js/my_amd_module.js
      function(myModule)
      {
        myModule.sayHello();
        myModule.doSomething();        
      });
    &lt;/script&gt;
&lt;/html&gt;</pre></div></div>

<h2>./js/my_amd_module.js</h2>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">define<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'js/my_amd_module'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// module name, has to match filename (without .js)</span>
  <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'js/jquery-1.7.min'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// requirements of this module (./js/jquery-1.7.min.js)</span>
  <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// $ for jQuery</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
      sayHello<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Hello World!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      doSomething<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'I did.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/javascript/javascript-amd-example-with-requirejs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mit Java in eine Textdatei schreiben</title>
		<link>http://www.bennyn.de/programmierung/java/mit-java-in-eine-textdatei-schreiben.html</link>
		<comments>http://www.bennyn.de/programmierung/java/mit-java-in-eine-textdatei-schreiben.html#comments</comments>
		<pubDate>Fri, 13 Jan 2012 21:53:39 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Inhalt]]></category>
		<category><![CDATA[schreiben]]></category>
		<category><![CDATA[Textdatei]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3128</guid>
		<description><![CDATA[Mit dem folgendem Code kann ein beliebiger Inhalt in eine Textdatei geschrieben werden. Sollte die Datei bereits existieren, wird der Text am Ende der Datei angefügt: import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; &#160; public class SimpleFileWriter &#123; &#160; static final Logger logger = Logger.getLogger&#40;SimpleFileWriter.class.getName&#40;&#41;&#41;; &#160; public static void writeFile&#40;String pathName, String [...]]]></description>
			<content:encoded><![CDATA[<p>Mit dem folgendem Code kann ein beliebiger Inhalt in eine Textdatei geschrieben werden. Sollte die Datei bereits existieren, wird der Text am Ende der Datei angefügt:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileWriter</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Level</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SimpleFileWriter
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>SimpleFileWriter.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> writeFile<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> pathName, <span style="color: #003399;">String</span> content<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">File</span> file <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>pathName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">FileWriter</span> writer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileWriter</span><span style="color: #009900;">&#40;</span>file, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      writer.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      writer.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">try</span>
    <span style="color: #009900;">&#123;</span>
      writeFile<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;C:/Temp/test.txt&quot;</span>, <span style="color: #0000ff;">&quot;Hello World!&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;line.separator&quot;</span>, <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Data was successfully written.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> ex<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      logger.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">WARNING</span>, ex.<span style="color: #006633;">getLocalizedMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/java/mit-java-in-eine-textdatei-schreiben.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Java 7 on Debian</title>
		<link>http://www.bennyn.de/webanwendungen/virtual-server/how-to-install-java-7-on-debian.html</link>
		<comments>http://www.bennyn.de/webanwendungen/virtual-server/how-to-install-java-7-on-debian.html#comments</comments>
		<pubDate>Fri, 13 Jan 2012 21:13:23 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[Virtual Server]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java 7]]></category>
		<category><![CDATA[JDK]]></category>
		<category><![CDATA[JRE]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3123</guid>
		<description><![CDATA[Here is a tutorial on how to install the latest Java 7 JDK and JRE on a Debian Linux system: 1 2 3 4 5 6 7 8 9 10 11 12 13 apt-get update &#38;&#38; apt-get upgrade -y sudo apt-get install sun-java6-jdk -y mkdir /tmp/downloads &#38;&#38; cd /tmp/downloads wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz tar -xvf jdk-7u2-linux-i586.tar.gz mv [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a tutorial on how to install the latest Java 7 JDK and JRE on a Debian Linux system:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade <span style="color: #660033;">-y</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sun-java6-jdk <span style="color: #660033;">-y</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>downloads <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>downloads 
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.oracle.com<span style="color: #000000; font-weight: bold;">/</span>otn-pub<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>jdk<span style="color: #000000; font-weight: bold;">/</span>7u2-b13<span style="color: #000000; font-weight: bold;">/</span>jdk-7u2-linux-i586.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvf</span> jdk-7u2-linux-i586.tar.gz
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>jdk1.7.0_02 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>jdk1.7.0_02 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">7</span>-oracle
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--install</span> <span style="color: #ff0000;">&quot;/usr/bin/java&quot;</span> <span style="color: #ff0000;">&quot;java&quot;</span> <span style="color: #ff0000;">&quot;/usr/lib/jvm/java-7-oracle/bin/java&quot;</span> <span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--install</span> <span style="color: #ff0000;">&quot;/usr/bin/javac&quot;</span> <span style="color: #ff0000;">&quot;javac&quot;</span> <span style="color: #ff0000;">&quot;/usr/lib/jvm/java-7-oracle/bin/javac&quot;</span> <span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--install</span> <span style="color: #ff0000;">&quot;/usr/bin/javaws&quot;</span> <span style="color: #ff0000;">&quot;javaws&quot;</span> <span style="color: #ff0000;">&quot;/usr/lib/jvm/java-7-oracle/bin/javaws&quot;</span> <span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--config</span> java
java <span style="color: #660033;">-version</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>downloads</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/webanwendungen/virtual-server/how-to-install-java-7-on-debian.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print Windows cmd output with Java</title>
		<link>http://www.bennyn.de/programmierung/java/print-windows-cmd-output-with-java.html</link>
		<comments>http://www.bennyn.de/programmierung/java/print-windows-cmd-output-with-java.html#comments</comments>
		<pubDate>Fri, 13 Jan 2012 20:17:11 +0000</pubDate>
		<dc:creator>bennyn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bennyn.de/?p=3119</guid>
		<description><![CDATA[For some Java applications it might be important to access the console to print some information from a console command. That&#8217;s why I wrote a little program which reads the output from the Windows command-line interface (cmd) and shows it on the screen. Note: This script also works on a Linux shell! 1 2 3 [...]]]></description>
			<content:encoded><![CDATA[<p>For some Java applications it might be important to access the console to print some information from a console command. That&#8217;s why I wrote a little program which reads the output from the Windows command-line interface (cmd) and shows it on the screen. Note: This script also works on a Linux shell!<br />
<span id="more-3119"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.UnsupportedEncodingException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Level</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ConsoleOutputPrinter
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>ConsoleOutputPrinter.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> getOutputFromConsoleCommand<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> command<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">UnsupportedEncodingException</span>, <span style="color: #003399;">IOException</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">Process</span> console <span style="color: #339933;">=</span> <span style="color: #003399;">Runtime</span>.<span style="color: #006633;">getRuntime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">exec</span><span style="color: #009900;">&#40;</span>command<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> consoleEncoding <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;os.name&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Windows&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      consoleEncoding <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CP850&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003399;">InputStream</span> is <span style="color: #339933;">=</span> console.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// use .getErrorStream() for error messages!</span>
    <span style="color: #003399;">BufferedReader</span> br <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>is, consoleEncoding<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    StringBuilder sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> line <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> br.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;line.separator&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> sb.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">try</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #003399;">String</span> consoleOutput <span style="color: #339933;">=</span> getOutputFromConsoleCommand<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ping localhost&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>consoleOutput<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> ex<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      logger.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">WARNING</span>, ex.<span style="color: #006633;">getLocalizedMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bennyn.de/programmierung/java/print-windows-cmd-output-with-java.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

