<?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>codegods &#187; Java</title>
	<atom:link href="http://codegods.de/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://codegods.de</link>
	<description>where code meets experts</description>
	<lastBuildDate>Tue, 17 Aug 2010 19:16:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Buildr bzw. rake verabschiedet sich mit Segmentation Fault</title>
		<link>http://codegods.de/2010/04/08/buildr-bzw-rake-verabschiedet-sich-mit-segmentation-fault/</link>
		<comments>http://codegods.de/2010/04/08/buildr-bzw-rake-verabschiedet-sich-mit-segmentation-fault/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 00:34:41 +0000</pubDate>
		<dc:creator>Sebastian Henke</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby/Rails]]></category>
		<category><![CDATA[buildr]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[Rakefile]]></category>

		<guid isPermaLink="false">http://codegods.de/?p=223</guid>
		<description><![CDATA[Wenn der Aufruf von Buildr bzw. rake durch Segmentation Fault abbricht, statt mit Java 1.6 mit Java 1.5 testen. Buildr unterstützt bis zur Version 1.2.10 nur Java5.]]></description>
			<content:encoded><![CDATA[<p>Wenn der Aufruf von Buildr bzw. rake durch Segmentation Fault abbricht, statt mit Java 1.6 mit Java 1.5 testen. Buildr unterstützt bis zur Version 1.2.10 nur Java5.</p>
]]></content:encoded>
			<wfw:commentRss>http://codegods.de/2010/04/08/buildr-bzw-rake-verabschiedet-sich-mit-segmentation-fault/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JADE: Start agents function code</title>
		<link>http://codegods.de/2008/11/18/jade-start-agents-function-code/</link>
		<comments>http://codegods.de/2008/11/18/jade-start-agents-function-code/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 16:31:20 +0000</pubDate>
		<dc:creator>Sebastian Henke</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ACLMessage]]></category>
		<category><![CDATA[agent]]></category>
		<category><![CDATA[FIPA]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[jade]]></category>
		<category><![CDATA[ontology]]></category>

		<guid isPermaLink="false">http://codegods.de/?p=91</guid>
		<description><![CDATA[Code zu schreiben, der in Jade neue Agents erstellt erfordert einiges an Aufwand und kann an Kleinigkeiten scheitern. Daher stelle ich hier meine Version zur Verfügung, in der Hoffnung, dass sie anderen entwicklern einiges an Nerven erspart. Es handelt sich um eine komplette Funktion, die in eine beliebige Klasse eingebunden werden kann. Zusätzlich müssen natürlich [...]]]></description>
			<content:encoded><![CDATA[<p>Code zu schreiben, der in Jade neue Agents erstellt erfordert einiges an Aufwand und kann an Kleinigkeiten scheitern. Daher stelle ich hier meine Version zur Verfügung, in der Hoffnung, dass sie anderen entwicklern einiges an Nerven erspart. Es handelt sich um eine komplette Funktion, die in eine beliebige Klasse eingebunden werden kann. Zusätzlich müssen natürlich die passenden Imports eingefügt werden.</p>
<p>Implementing code in JADE to be able to create new agents using java code can be really annoying. To prevent you to spent several hours to figure out how to realize such code, find my version here. You can put this function to any existing class. Remember to organize your imports.<br />
<span id="more-91"></span></p>
<pre class="java">&nbsp;
<span style="color: #808080; font-style: italic;">/*****************************************************************
	* Very interesting function to start any agent of any class on any container
	* agent is the agent, from where you want to create another agent. The other variables are
	* should be self-explanatory.
	*****************************************************************/</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> startAgent<span style="color: #66cc66;">&#40;</span>Agent agent, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> agentName, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> containerName, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> className, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> arg<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> ownerName<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		CreateAgent ca = <span style="color: #000000; font-weight: bold;">new</span> CreateAgent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>containerName.<span style="color: #006600;">equals</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
			containerName = AgentContainer.<span style="color: #006600;">MAIN_CONTAINER_NAME</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">// fill the create action with the intended agent owner</span>
		jade.<span style="color: #006600;">security</span>.<span style="color: #006600;">JADEPrincipal</span> intendedOwner = <span style="color: #000000; font-weight: bold;">null</span>;
		jade.<span style="color: #006600;">security</span>.<span style="color: #006600;">Credentials</span> initialCredentials = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ownerName==<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> || <span style="color: #66cc66;">&#40;</span>ownerName.<span style="color: #006600;">trim</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// it is requested the creation of an agent</span>
			<span style="color: #808080; font-style: italic;">// with the same owner of the RMA</span>
			<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
				jade.<span style="color: #006600;">security</span>.<span style="color: #006600;">JADEPrincipal</span> rmaOwner = <span style="color: #000000; font-weight: bold;">null</span>;
				jade.<span style="color: #006600;">security</span>.<span style="color: #006600;">Credentials</span> rmaCredentials = <span style="color: #000000; font-weight: bold;">null</span>;
				jade.<span style="color: #006600;">security</span>.<span style="color: #006600;">CredentialsHelper</span> ch = <span style="color: #66cc66;">&#40;</span>jade.<span style="color: #006600;">security</span>.<span style="color: #006600;">CredentialsHelper</span><span style="color: #66cc66;">&#41;</span> agent.<span style="color: #006600;">getHelper</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;jade.core.security.Security&quot;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #808080; font-style: italic;">// get RMA's owner</span>
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ch!=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>  rmaCredentials = ch.<span style="color: #006600;">getCredentials</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;    <span style="color: #66cc66;">&#125;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rmaCredentials!=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>  rmaOwner = rmaCredentials.<span style="color: #006600;">getOwner</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;    <span style="color: #66cc66;">&#125;</span>
				intendedOwner = rmaOwner;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>ServiceException se<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// Security service not present. Owner is null.</span>
				intendedOwner=<span style="color: #000000; font-weight: bold;">null</span>;
				initialCredentials=<span style="color: #000000; font-weight: bold;">null</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// it is requested the creation of an agent</span>
			<span style="color: #808080; font-style: italic;">// with a specified owner name</span>
			<span style="color: #000000; font-weight: bold;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">Class</span> c = <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006600;">forName</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;jade.security.impl.JADEPrincipalImpl&quot;</span><span style="color: #66cc66;">&#41;</span>;
				intendedOwner = <span style="color: #66cc66;">&#40;</span>JADEPrincipal<span style="color: #66cc66;">&#41;</span> c.<span style="color: #006600;">newInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				java.<span style="color: #006600;">lang</span>.<span style="color: #006600;">reflect</span>.<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AMethod+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Method</span></a> setName = c.<span style="color: #006600;">getDeclaredMethod</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;setName&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">Class</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#123;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a>.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
				setName.<span style="color: #006600;">invoke</span><span style="color: #66cc66;">&#40;</span>intendedOwner, <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Object</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span>ownerName<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> e<span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #808080; font-style: italic;">//e.printStackTrace();</span>
				<span style="color: #808080; font-style: italic;">// Security service not present. Owner is null.</span>
				intendedOwner=<span style="color: #000000; font-weight: bold;">null</span>;
				initialCredentials=<span style="color: #000000; font-weight: bold;">null</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		ca.<span style="color: #006600;">setOwner</span><span style="color: #66cc66;">&#40;</span> intendedOwner <span style="color: #66cc66;">&#41;</span>;
		ca.<span style="color: #006600;">setInitialCredentials</span><span style="color: #66cc66;">&#40;</span> initialCredentials <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		ca.<span style="color: #006600;">setAgentName</span><span style="color: #66cc66;">&#40;</span>agentName<span style="color: #66cc66;">&#41;</span>;
		ca.<span style="color: #006600;">setClassName</span><span style="color: #66cc66;">&#40;</span>className<span style="color: #66cc66;">&#41;</span>;
		ca.<span style="color: #006600;">setContainer</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ContainerID<span style="color: #66cc66;">&#40;</span>containerName, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>arg != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i&lt;arg.<span style="color: #006600;">length</span> ; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				ca.<span style="color: #006600;">addArguments</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Object</span></a><span style="color: #66cc66;">&#41;</span>arg<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AAction+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Action</span></a> a = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AAction+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Action</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			a.<span style="color: #006600;">setActor</span><span style="color: #66cc66;">&#40;</span>agent.<span style="color: #006600;">getAMS</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			a.<span style="color: #006600;">setAction</span><span style="color: #66cc66;">&#40;</span>ca<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			ACLMessage requestMsg = <span style="color: #000000; font-weight: bold;">new</span> ACLMessage<span style="color: #66cc66;">&#40;</span>ACLMessage.<span style="color: #006600;">REQUEST</span><span style="color: #66cc66;">&#41;</span>;
			requestMsg.<span style="color: #006600;">setSender</span><span style="color: #66cc66;">&#40;</span>agent.<span style="color: #006600;">getAID</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			requestMsg.<span style="color: #006600;">addReceiver</span><span style="color: #66cc66;">&#40;</span>agent.<span style="color: #006600;">getAMS</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			requestMsg.<span style="color: #006600;">setProtocol</span><span style="color: #66cc66;">&#40;</span>FIPANames.<span style="color: #006600;">InteractionProtocol</span>.<span style="color: #006600;">FIPA_REQUEST</span><span style="color: #66cc66;">&#41;</span>;
			requestMsg.<span style="color: #006600;">setLanguage</span><span style="color: #66cc66;">&#40;</span>FIPANames.<span style="color: #006600;">ContentLanguage</span>.<span style="color: #006600;">FIPA_SL</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			requestMsg.<span style="color: #006600;">setOntology</span><span style="color: #66cc66;">&#40;</span>JADEManagementOntology.<span style="color: #006600;">NAME</span><span style="color: #66cc66;">&#41;</span>;
			agent.<span style="color: #006600;">getContentManager</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">fillContent</span><span style="color: #66cc66;">&#40;</span>requestMsg, a<span style="color: #66cc66;">&#41;</span>;
			SimpleAchieveREInitiator initiator = <span style="color: #000000; font-weight: bold;">new</span> SimpleAchieveREInitiator<span style="color: #66cc66;">&#40;</span>agent, requestMsg<span style="color: #66cc66;">&#41;</span>;
			agent.<span style="color: #006600;">addBehaviour</span><span style="color: #66cc66;">&#40;</span>initiator<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AException+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> fe<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			fe.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegods.de/2008/11/18/jade-start-agents-function-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Netbeans: Could not install module JDPA Debugger API</title>
		<link>http://codegods.de/2008/08/28/netbeans-could-not-install-module-jdpa-debugger-api/</link>
		<comments>http://codegods.de/2008/08/28/netbeans-could-not-install-module-jdpa-debugger-api/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 13:18:09 +0000</pubDate>
		<dc:creator>Sebastian Henke</dc:creator>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Debugger]]></category>
		<category><![CDATA[JDPA]]></category>
		<category><![CDATA[jre]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codegods.de/?p=45</guid>
		<description><![CDATA[Beim Starten von Netbeans erscheint folgende Fehlermeldung: Warning - could not install module JPDA Debugger API JPDA Debugger API - This module requires JDKHOME/lib/tools.jar to be accessible. This file was not found. Usually this means you are trying to run the IDE with the JRE instead of the full JDK. If so, please use the [...]]]></description>
			<content:encoded><![CDATA[<p>Beim Starten von Netbeans erscheint folgende Fehlermeldung:</p>
<pre>Warning - could not install module JPDA Debugger API
JPDA Debugger API - This module requires JDKHOME/lib/tools.jar to be accessible.
This file was not found. Usually this means you are trying to run the IDE with the JRE instead of the full JDK.
If so, please use the --jdkhome command line option to specify a JDK installation.</pre>
<p>Netbeans wird dann vermutlich anstatt mit dem SDK mit dem einfacheren JRE gestartet. Dieses enthält den JPDA Debugger nicht. Die Fehlermeldung verschwindet, sobald das SDK installiert wird.</p>
<p>Bei Ubuntu, Debian, ... erfolgt die Installation (als Root) mittels</p>
<pre>apt-get install sun-java6-jdk</pre>
<p>Bei anderen Betriebsystemen und solchen ohne Quellen für dieses Paket findet sich mit ein Download auf <a href="http://java.sun.com">http://java.sun.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://codegods.de/2008/08/28/netbeans-could-not-install-module-jdpa-debugger-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java und Compiz Workaround</title>
		<link>http://codegods.de/2008/03/29/java-und-compiz-workaround/</link>
		<comments>http://codegods.de/2008/03/29/java-und-compiz-workaround/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 12:29:36 +0000</pubDate>
		<dc:creator>Andreas Fritzler</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Comipz]]></category>

		<guid isPermaLink="false">http://codegods.de/2008/03/29/java-und-compiz-workaround/</guid>
		<description><![CDATA[Falls Java Programme bei gleichzeitigem Verwenden von Compiz nicht richtig angezeigt werden, hilft ein einfaches export AWT_TOOLKIT=MToolkit. Danach sollten die Programme wieder "benutzbar" sein.]]></description>
			<content:encoded><![CDATA[<p>Falls Java Programme bei gleichzeitigem Verwenden von Compiz nicht richtig angezeigt werden, hilft ein einfaches <code>export AWT_TOOLKIT=MToolkit</code>. Danach sollten die Programme wieder "benutzbar" sein. </p>
]]></content:encoded>
			<wfw:commentRss>http://codegods.de/2008/03/29/java-und-compiz-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Management Instrumentation (WMI) und Java</title>
		<link>http://codegods.de/2008/03/26/windows-management-instrumentation-wmi-und-java/</link>
		<comments>http://codegods.de/2008/03/26/windows-management-instrumentation-wmi-und-java/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 22:23:15 +0000</pubDate>
		<dc:creator>Dimitrij Wulf</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jawin]]></category>
		<category><![CDATA[system information]]></category>
		<category><![CDATA[windows management instrumentation]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://codegods.de/2008/03/26/windows-management-instrumentation-wmi-und-java/</guid>
		<description><![CDATA[Wenn man mit Java Systeminformationen auslesen möchte, so stößt man mit Java schnell an die Grenzen des Machbaren. Will man die CPU-Geschwindigkeit oder die installierten Festplatten so muss man dies über JNI und einer entsprechenden nativen Bibliothek bedienen. Mit WMI hat Microsoft eine Möglichkeit geschaffen lokal und über das Netzwerk auf alle erdenklichen Systeminformationen zu [...]]]></description>
			<content:encoded><![CDATA[<p>Wenn man mit Java Systeminformationen auslesen möchte, so stößt man mit Java schnell an die Grenzen des Machbaren. Will man die CPU-Geschwindigkeit oder die installierten Festplatten so muss man dies über JNI und einer entsprechenden nativen Bibliothek bedienen.<br />
Mit WMI hat Microsoft eine Möglichkeit geschaffen lokal und über das Netzwerk auf alle erdenklichen Systeminformationen zu zugreifen. WMI ist ab Windows 2000 fester Bestandteil der Microsoft Betriebssysteme. Für Windows 9x und NT 4.0 gibt es jedoch die Möglichkeit diese Funktionalität nach zu installieren.</p>
<p>Da jedoch diese Funktionalität als native Bibliothek vorliegt kann man nicht so ohne weiteres mit Java darauf zugreifen. Abhilfe schafft hier die freie Java-Bibliothek Jawin. Mit dieser Bibliothek ist es möglich auf DLLs oder auf COM-Objekte zu zugreifen. Zusätzlich bietet das Binär-Packet ein Tool namens Jawin Type Browser womit man Stubs für die nativen Objekte von WMI erstellen kann.</p>
<p>Will man nun von Java aus auf WMI zugreifen so erstellt man zuerst Stub-Klassen für Methoden und Objekte mit dem Jawin Type Browser. Dabei startet man die jawinBrowser.jar Datei, die in dem Ordner typebrowser im Binär-Packet von Jawin enthalten ist. Nun erstellt man ein neues Projekt über das Menu Project und gibt einen Dateinamen für das Projekt an. Danach öffnet sich ein Fenster mit den Einstellungen des Projektes. Mit New wählt man nun die Datei wbemdisp.tlb im Ordner C:\windows\system32\wbem\ aus. Als letzte wichtige Einstellung muss noch das Verzeichnis angegeben werden wo die Jawin Stubs gespeichert werden sollen. Dieses legt man Textfeld "Export directory" fest.</p>
<p>Jetzt klickt man auf "Code Generation" und dann auf "Generate full code" wodurch intern die Stubs erstellt wurden. Um diese schließlich in das Verzeichnis zu lagern muss noch auf "Save Java files" im Menü "Code Generation" geklickt werden.</p>
<p>Wurde alles erfolgreich beendet kann man jetzt mit der eigentlichen Programmierung loslegen. Man muss noch darauf achten, dass man das Verzeichnis, in dem die jawin.jar liegt im classpath anpasst.</p>
<p>Hier stelle ich eine Beispielimplementierung rein. Damit ist es möglich die CPU-Frequenz und den Namen auszulesen.</p>
<pre class="java">&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> args<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> COMException <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> computerName = <span style="color: #ff0000;">&quot;.&quot;</span>;
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> userName = <span style="color: #ff0000;">&quot;&quot;</span>;
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> password = <span style="color: #ff0000;">&quot;&quot;</span>;
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> namespace = <span style="color: #ff0000;">&quot;root/cimv2&quot;</span>;
&nbsp;
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a> queryProcessor = <span style="color: #ff0000;">&quot;SELECT * FROM Win32_Processor&quot;</span>;
&nbsp;
    DispatchPtr dispatcher = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
        ISWbemLocator locator = <span style="color: #000000; font-weight: bold;">new</span> ISWbemLocator<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;WbemScripting.SWbemLocator&quot;</span><span style="color: #66cc66;">&#41;</span>;
        ISWbemServices wbemServices = locator.<span style="color: #006600;">ConnectServer</span><span style="color: #66cc66;">&#40;</span>computerName, namespace, userName, password, <span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #cc66cc;">0</span>, dispatcher<span style="color: #66cc66;">&#41;</span>;
        ISWbemObjectSet wbemObjectSet = wbemServices.<span style="color: #006600;">ExecQuery</span><span style="color: #66cc66;">&#40;</span>queryProcessor, <span style="color: #ff0000;">&quot;WQL&quot;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;
        DispatchPtr<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> results = <span style="color: #000000; font-weight: bold;">new</span> DispatchPtr<span style="color: #66cc66;">&#91;</span>wbemObjectSet.<span style="color: #006600;">getCount</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;
        IUnknown unknown = wbemObjectSet.<span style="color: #006600;">get_NewEnum</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        IEnumVariant enumVariant = <span style="color: #66cc66;">&#40;</span>IEnumVariant<span style="color: #66cc66;">&#41;</span> unknown.<span style="color: #006600;">queryInterface</span><span style="color: #66cc66;">&#40;</span>IEnumVariant.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        enumVariant.<span style="color: #006600;">Next</span><span style="color: #66cc66;">&#40;</span>wbemObjectSet.<span style="color: #006600;">getCount</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, results<span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;">0</span>; i &amp;lt; results.<span style="color: #006600;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            ISWbemObject wbemObject = <span style="color: #66cc66;">&#40;</span>ISWbemObject<span style="color: #66cc66;">&#41;</span> results<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">queryInterface</span><span style="color: #66cc66;">&#40;</span>ISWbemObject.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
           <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Name: &quot;</span> + wbemObject.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Name&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
           <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;CurrentClockSpeed: &quot;</span> + wbemObject.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;CurrentClockSpeed&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>COMException e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>Das gleiche als VBScript würde folgendermaßen aussehen:</p>
<pre class="vb">&nbsp;
computerName = <span style="color: #ff0000;">&quot;.&quot;</span>
<span style="color: #b1b100;">Set</span> wmi = <span style="color: #b1b100;">GetObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;winmgmts:\\&quot;</span> &amp;amp; computerName &amp;amp; <span style="color: #ff0000;">&quot;\root\cimv2&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">Set</span> colItems = wmi.<span style="color: #66cc66;">ExecQuery</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select * from win32_processor&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #b1b100;">For</span> Each objItem in colItems
    WScript.<span style="color: #66cc66;">Echo</span> objItem.<span style="color: #b1b100;">Name</span>
    WScript.<span style="color: #66cc66;">Echo</span> objItem.<span style="color: #66cc66;">CurrentClockSpeed</span>
<span style="color: #b1b100;">Next</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://codegods.de/2008/03/26/windows-management-instrumentation-wmi-und-java/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>No suitable driver found for jdbc</title>
		<link>http://codegods.de/2007/06/02/no-suitable-driver-found-for-jdbc/</link>
		<comments>http://codegods.de/2007/06/02/no-suitable-driver-found-for-jdbc/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 11:38:34 +0000</pubDate>
		<dc:creator>Andreas Fritzler</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://codegods.de/2007/06/02/no-suitable-driver-found-for-jdbc/</guid>
		<description><![CDATA[Beim Entwickeln von Java Web Services die auf eine MySQL Datenbank zugreifen sollen, kann es beim ersten Testversuch zu folgender Fehlermeldung kommen: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:1234 Das Problem hierbei ist, dass dem Web Service die entsprechende MySQL Connector Jar fehlt. Es ist durchaus möglich, dass der Code vorher als Consolenprogramm getestet wurde [...]]]></description>
			<content:encoded><![CDATA[<p>
Beim Entwickeln von Java Web Services die auf eine MySQL Datenbank zugreifen sollen, kann es beim ersten Testversuch zu folgender Fehlermeldung kommen:
</p>
<p><code> java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:1234</code></p>
<p>
Das Problem hierbei ist, dass dem Web Service die entsprechende MySQL Connector Jar fehlt. Es ist durchaus möglich, dass der Code vorher als Consolenprogramm getestet wurde und dort alles einwandfrei funktionierte. Um dieses Problem zu lösen, muss man in den Web Content Ordner
</p>
<p><code>WEBCONTENT/WEB-INF/lib</code></p>
<p>
den entsprechenden MySQL Connector kopieren. Danach sollte der Service einwandfrei mit der Datenbank zusammen arbeiten.
</p>
<p><span id="more-25"></span><br />
<script src="http://bin-layer.de/layer-6116-3-subid:codegods.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://codegods.de/2007/06/02/no-suitable-driver-found-for-jdbc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

