<?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>Java, Programming, Struts2, jQuery, Linux and more &#187; options</title>
	<atom:link href="http://www.jgeppert.com/tag/options/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jgeppert.com</link>
	<description>Johannes Geppert</description>
	<lastBuildDate>Thu, 09 Feb 2012 16:38:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Java Einstellungen wieder laden</title>
		<link>http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/</link>
		<comments>http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 19:38:25 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[laden]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[properties]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=16</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/' addthis:title='Java Einstellungen wieder laden '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Um mit Java ein gespeichert Einstellungen wieder zu laden verwendet folgenden Code. try &#123; File f = new File&#40;&#34;options.properties&#34;&#41;; Properties p = new Properties&#40;&#41;; p.loadFromXML&#40;new FileInputStream&#40;f&#41;&#41;; &#160; port = p.getProperty&#40;&#34;port&#34;&#41;; host = p.getProperty&#40;&#34;host&#34;&#41;; &#125; catch &#40;Exception e&#41; &#123; System.out.println&#40;&#34;No options found, using default!&#34;&#41;; &#125;<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/' addthis:title='Java Einstellungen wieder laden ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/' addthis:title='Java Einstellungen wieder laden '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Um mit Java ein gespeichert Einstellungen wieder zu laden verwendet folgenden Code.


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">try</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #003399;">File</span> f <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><span style="color: #0000ff;">&quot;options.properties&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">Properties</span> p <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Properties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
p.<span style="color: #006633;">loadFromXML</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileInputStream</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
port <span style="color: #339933;">=</span> p.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;port&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
host <span style="color: #339933;">=</span> p.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&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;">Exception</span> e<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</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;No options found, using default!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/' addthis:title='Java Einstellungen wieder laden ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2008/07/java-einstellungen-wieder-laden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Einstellungen speichern</title>
		<link>http://www.jgeppert.com/2008/07/java-einstellungen-speichern/</link>
		<comments>http://www.jgeppert.com/2008/07/java-einstellungen-speichern/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 19:35:53 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[speichern]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=14</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-speichern/' addthis:title='Java Einstellungen speichern '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Um in Java Einstellungen zu speichern, um zum Beispiel eine Konfiguration zu sichern, könnt Ihr wie folgt vorgehen. File f = new File&#40;&#34;options.properties&#34;&#41;; Properties p = new Properties&#40;&#41;; &#160; p.setProperty&#40;&#34;port&#34;, &#34;8080&#34;&#41;; p.setProperty&#40;&#34;host&#34;, &#34;localhost&#34;&#41;; &#160; p.storeToXML&#40;new FileOutputStream&#40;f&#41;, new Date&#40;System.currentTimeMillis&#40;&#41;&#41;.toString&#40;&#41;&#41;;<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-speichern/' addthis:title='Java Einstellungen speichern ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-speichern/' addthis:title='Java Einstellungen speichern '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Um in Java Einstellungen zu speichern, um zum Beispiel eine Konfiguration zu sichern, könnt Ihr wie folgt vorgehen.


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">File</span> f <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><span style="color: #0000ff;">&quot;options.properties&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">Properties</span> p <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Properties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
p.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;port&quot;</span>, <span style="color: #0000ff;">&quot;8080&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
p.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span>, <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
p.<span style="color: #006633;">storeToXML</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileOutputStream</span><span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2008/07/java-einstellungen-speichern/' addthis:title='Java Einstellungen speichern ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2008/07/java-einstellungen-speichern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

