<?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>btaz &#187; Java</title>
	<atom:link href="http://www.btaz.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.btaz.com</link>
	<description>Promoting the art of coding</description>
	<lastBuildDate>Fri, 16 Jul 2010 17:01:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DbVisualizer auto commit problem</title>
		<link>http://www.btaz.com/java/jdbc/dbvisualizer-auto-commit-problem/</link>
		<comments>http://www.btaz.com/java/jdbc/dbvisualizer-auto-commit-problem/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:47:30 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[JDBC]]></category>
		<category><![CDATA[auto commit]]></category>
		<category><![CDATA[DbVisualizer]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=157</guid>
		<description><![CDATA[I had some issues with DbVisualizer and auto commit. I wanted to be able to turn it off from the SQL commander. The official documentation states that you can do this using:
The Auto Commit setting is enabled by default and can be adjusted in the Connection Properties. You may also adjust the  auto commit state [...]


Related posts:<ol><li><a href='http://www.btaz.com/databases/oracle/sqlloader-522-lfiopn-failed-for-file-loader-log/' rel='bookmark' title='Permanent Link: SQL*Loader-522: lfiopn failed for file (loader.log)'>SQL*Loader-522: lfiopn failed for file (loader.log)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I had some issues with DbVisualizer and auto commit. I wanted to be able to turn it off from the SQL commander. The official documentation states that you can do this using:</p>
<p><span style="color: #0000ff;">The Auto Commit setting is enabled by default and can be adjusted in the Connection Properties. You may also adjust the  auto commit state for the SQL editor you are using in the SQL Commander with the following command:</span></p>
<p>@set autocommit true/false</p>
<p>Unfortunately this didn&#8217;t work for  me in either 6.5.12 or 7.04 (I&#8217;m using OS X and Java 6) against an Oracle 10g database. I get an error alert stating &#8220;/application/set autocommit false (No such file or directory)&#8221;<br />
I was finally able to figure out that you can get it to work using:</p>
<p><span style="color: #0000ff;">@set autocommit off/on</span></p>
<p>I&#8217;m not sure if this is a problem that only occur on OS X.</p>


<p>Related posts:<ol><li><a href='http://www.btaz.com/databases/oracle/sqlloader-522-lfiopn-failed-for-file-loader-log/' rel='bookmark' title='Permanent Link: SQL*Loader-522: lfiopn failed for file (loader.log)'>SQL*Loader-522: lfiopn failed for file (loader.log)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/jdbc/dbvisualizer-auto-commit-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java primitive data type sizes for byte, short, int, long, float, double and char</title>
		<link>http://www.btaz.com/java/java-primitive-data-type-sizes-for-byte-short-int-long-float-double-and-char/</link>
		<comments>http://www.btaz.com/java/java-primitive-data-type-sizes-for-byte-short-int-long-float-double-and-char/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 21:32:37 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[char]]></category>
		<category><![CDATA[data type]]></category>
		<category><![CDATA[default value]]></category>
		<category><![CDATA[digits]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[min]]></category>
		<category><![CDATA[primitive data types]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[size]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=113</guid>
		<description><![CDATA[
table {
width:100%;
border:1px solid #e5eff8;
margin:1em auto;
border-collapse:collapse;
}
th {
color:#678197;
border: 1px solid #e5eff8;
padding: 2px;
text-align:center;
font-weight: bold;
text-align: left;
}
td {
color:#678197;
border:1px solid #e5eff8;
padding: 2px;
text-align:left;
}

A handy list for Java data types and sizes
Integer Data Types



Data Type
Size
Digits
Min
Max


byte
8-bit signed
3
-128
127


short
16-bit signed
5
-32,768
32,767


int
32-bit signed
10
-2,147,483,648
2,147,483,647


long
64-bit signed
19
-9,223,372,036,854,775,808
9,223,372,036,854,775,807




Floating Point Data Types



Data Type
Size


float
single-precision 32-bit IEEE 754 floating point


double
double-precision 64-bit IEEE 754 floating point




Boolean Data Types



Data Type
Values


boolean
true or false




Character Data Types



Data Type
Min
Max


char
\u0000 or 0
\uffff [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/java-and-the-current-work-directory/' rel='bookmark' title='Permanent Link: Java and the current work directory'>Java and the current work directory</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
<p>table {
width:100%;
border:1px solid #e5eff8;
margin:1em auto;
border-collapse:collapse;
}
th {
color:#678197;
border: 1px solid #e5eff8;
padding: 2px;
text-align:center;
font-weight: bold;
text-align: left;
}
td {
color:#678197;
border:1px solid #e5eff8;
padding: 2px;
text-align:left;
}</p>
</style>
<p>A handy list for Java data types and sizes</p>
<h3>Integer Data Types</h3>
<table border="0">
<tbody>
<tr>
<th>Data Type</th>
<th>Size</th>
<th>Digits</th>
<th>Min</th>
<th>Max</th>
</tr>
<tr>
<td>byte</td>
<td>8-bit signed</td>
<td>3</td>
<td>-128</td>
<td>127</td>
</tr>
<tr>
<td>short</td>
<td>16-bit signed</td>
<td>5</td>
<td>-32,768</td>
<td>32,767</td>
</tr>
<tr>
<td>int</td>
<td>32-bit signed</td>
<td>10</td>
<td>-2,147,483,648</td>
<td>2,147,483,647</td>
</tr>
<tr>
<td>long</td>
<td>64-bit signed</td>
<td>19</td>
<td>-9,223,372,036,854,775,808</td>
<td>9,223,372,036,854,775,807</td>
</tr>
</tbody>
</table>
<p></p>
<h3>Floating Point Data Types</h3>
<table border="0">
<tbody>
<tr>
<th>Data Type</th>
<th>Size</th>
</tr>
<tr>
<td>float</td>
<td>single-precision 32-bit IEEE 754 floating point</td>
</tr>
<tr>
<td>double</td>
<td>double-precision 64-bit IEEE 754 floating point</td>
</tr>
</tbody>
</table>
<p></p>
<h3>Boolean Data Types</h3>
<table border="0">
<tbody>
<tr>
<th>Data Type</th>
<th>Values</th>
</tr>
<tr>
<td>boolean</td>
<td>true or false</td>
</tr>
</tbody>
</table>
<p></p>
<h3>Character Data Types</h3>
<table border="0">
<tbody>
<tr>
<th>Data Type</th>
<th>Min</th>
<th>Max</th>
</tr>
<tr>
<td>char</td>
<td>\u0000 or 0</td>
<td>\uffff or 65,535</td>
</tr>
</tbody>
</table>
<p></p>
<h3>Default Values</h3>
<table border="0">
<tbody>
<tr>
<th>Data Type</th>
<th>Default Value</th>
</tr>
<tr>
<td>byte</td>
<td>0</td>
</tr>
<tr>
<td>short</td>
<td>0</td>
</tr>
<tr>
<td>int</td>
<td>0</td>
</tr>
<tr>
<td>long</td>
<td>0L</td>
</tr>
<tr>
<td>float</td>
<td>0.0f</td>
</tr>
<tr>
<td>double</td>
<td>0.0d</td>
</tr>
<tr>
<td>char</td>
<td>&#8216;\u0000&#8242;</td>
</tr>
<tr>
<td>boolean</td>
<td>false</td>
</tr>
<tr>
<td>Any Object(s)</td>
<td>null</td>
</tr>
</tbody>
</table>
<p>
References:<br />
<a href="http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html">http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html</a></p>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/java-and-the-current-work-directory/' rel='bookmark' title='Permanent Link: Java and the current work directory'>Java and the current work directory</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/java-primitive-data-type-sizes-for-byte-short-int-long-float-double-and-char/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find project dependencies in a Maven project</title>
		<link>http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/</link>
		<comments>http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 09:45:09 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[class path]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[pom.xml]]></category>
		<category><![CDATA[see a list of dependencies]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=109</guid>
		<description><![CDATA[
It&#8217;s very useful to be able to see what is included in your class path especially when you&#8217;re trying to track down a troublesome dependency. Recently I had an issue with a JDOM dependency; however I had not defined a JDOM dependency in my pom.xml file and I couldn&#8217;t quite figure out why this dependency [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/' rel='bookmark' title='Permanent Link: Want to use Spring 3.0 milestone release from Maven?'>Want to use Spring 3.0 milestone release from Maven?</a></li>
<li><a href='http://www.btaz.com/java/maven-log4j-and-javax-jms/' rel='bookmark' title='Permanent Link: Maven, Log4j and javax.jms'>Maven, Log4j and javax.jms</a></li>
<li><a href='http://www.btaz.com/java/maven/18/' rel='bookmark' title='Permanent Link: Maven pom.xml structure'>Maven pom.xml structure</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-110" title="cog-wheels" src="http://www.btaz.com/wp-content/uploads/2009/10/cog-wheels.jpg" alt="cog-wheels" width="296" height="199" /><br />
It&#8217;s very useful to be able to see what is included in your class path especially when you&#8217;re trying to track down a troublesome dependency. Recently I had an issue with a JDOM dependency; however I had not defined a JDOM dependency in my pom.xml file and I couldn&#8217;t quite figure out why this dependency existed. This is where Maven&#8217;s excellent dependency plugin comes to the rescue.</p>
<p>In a project you may have dependencies on libraries like Log4J or Freemarker. These libraries in their turn may have dependencies on other libraries, this is also known as transitive dependencies.</p>
<p>Using the following Maven command we&#8217;ll be able to see a list of these dependencies:</p>
<pre>mvn dependency:resolve</pre>
<p>For a nice tree view of the same information use:</p>
<pre>mvn dependency:tree</pre>
<p>If you want to see a full dependency trail that also show you artifacts that were rejected due to conflicts or other reasons then run maven with the debug flag enabled:</p>
<pre>mvn install -X</pre>
<p>For more information about the Maven dependency plugin go here: <a title="Maven dependency plugin" href="http://maven.apache.org/plugins/maven-dependency-plugin/">http://maven.apache.org/plugins/maven-dependency-plugin/</a></p>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/' rel='bookmark' title='Permanent Link: Want to use Spring 3.0 milestone release from Maven?'>Want to use Spring 3.0 milestone release from Maven?</a></li>
<li><a href='http://www.btaz.com/java/maven-log4j-and-javax-jms/' rel='bookmark' title='Permanent Link: Maven, Log4j and javax.jms'>Maven, Log4j and javax.jms</a></li>
<li><a href='http://www.btaz.com/java/maven/18/' rel='bookmark' title='Permanent Link: Maven pom.xml structure'>Maven pom.xml structure</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Want to use Spring 3.0 milestone release from Maven?</title>
		<link>http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/</link>
		<comments>http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 06:12:25 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[artifact]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[early access]]></category>
		<category><![CDATA[maven repository]]></category>
		<category><![CDATA[pom.xml]]></category>
		<category><![CDATA[snapshot releases]]></category>
		<category><![CDATA[spring milestone release]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=81</guid>
		<description><![CDATA[I wanted to add the Spring 3.0 M4 milestone early access release to a Maven project to test out some of the new features. However Spring  milestone releases are not readily available in the standard public Maven repositories, so what do you do?
For the full explanation check out the link to &#8220;Spring/Maven Repositories&#8221; link in [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/maven-log4j-and-javax-jms/' rel='bookmark' title='Permanent Link: Maven, Log4j and javax.jms'>Maven, Log4j and javax.jms</a></li>
<li><a href='http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/' rel='bookmark' title='Permanent Link: How to find project dependencies in a Maven project'>How to find project dependencies in a Maven project</a></li>
<li><a href='http://www.btaz.com/java/maven/18/' rel='bookmark' title='Permanent Link: Maven pom.xml structure'>Maven pom.xml structure</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I wanted to add the Spring 3.0 M4 milestone early access release to a Maven project to test out some of the new features. However Spring  milestone releases are not readily available in the standard public Maven repositories, so what do you do?</p>
<p>For the full explanation check out the link to &#8220;Spring/Maven Repositories&#8221; link in the bottom. For a quick 1-2-3 step solution add this to the &lt;repositories&gt; section in your Maven pom.xml file so that Maven can find Spring&#8217;s early access milestone releases:</p>
<div>
<pre><span style="color: #0000ff;">&lt;repository&gt;
  &lt;id&gt;spring-milestone&lt;/id&gt;
  &lt;name&gt;Spring Portfolio Milestone Repository&lt;/name&gt;
  &lt;url&gt;http://s3.amazonaws.com/maven.springframework.org/milestone&lt;/url&gt;
&lt;/repository&gt;</span></pre>
<div>You can then add Spring 3.0 M4 as a dependency in your pom.xml file:</div>
<pre><span style="color: #0000ff;">&lt;dependency&gt;
  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;version&gt;3.0.0.M4&lt;/version&gt;
&lt;/dependency&gt;</span></pre>
<div>If you&#8217;re looking for other Spring artifacts you can browse them using this <a title="Spring Maven artifact URL" href="http://s3browse.com/explore/maven.springframework.org/milestone">Spring Maven artifact URL</a></div>
<div>
<p>This Spring article has additional details on this topic e.g  how to access snapshot releases:</p>
<p><a title="Spring / Maven Repositories" href="http://blog.springsource.com/2007/09/18/maven-artifacts-2/">Spring/Maven Repositories</a></div>
</div>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/maven-log4j-and-javax-jms/' rel='bookmark' title='Permanent Link: Maven, Log4j and javax.jms'>Maven, Log4j and javax.jms</a></li>
<li><a href='http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/' rel='bookmark' title='Permanent Link: How to find project dependencies in a Maven project'>How to find project dependencies in a Maven project</a></li>
<li><a href='http://www.btaz.com/java/maven/18/' rel='bookmark' title='Permanent Link: Maven pom.xml structure'>Maven pom.xml structure</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JUnit 4 error: reference to assertEquals is ambiguous</title>
		<link>http://www.btaz.com/java/junit-4-error-reference-to-assertequals-is-ambiguous/</link>
		<comments>http://www.btaz.com/java/junit-4-error-reference-to-assertequals-is-ambiguous/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 19:56:21 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[ambiguous]]></category>
		<category><![CDATA[assertEqual]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=67</guid>
		<description><![CDATA[This is a somewhat confusing compilation failure that sometimes happen when you write unit tests using JUnit 4. This is an example code snippet that produces this error (result.getValue() returns an Integer object):
assertEquals(12345, result.getValue());
And when you try to compile your project it produces a compilation error like this:
/projects/myapp/src/test/java/org/myapp/MyTest.java:[88,8] reference to assertEquals is ambiguous, both method [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/java-primitive-data-type-sizes-for-byte-short-int-long-float-double-and-char/' rel='bookmark' title='Permanent Link: Java primitive data type sizes for byte, short, int, long, float, double and char'>Java primitive data type sizes for byte, short, int, long, float, double and char</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is a somewhat confusing compilation failure that sometimes happen when you write unit tests using JUnit 4. This is an example code snippet that produces this error (result.getValue() returns an Integer object):</p>
<pre>assertEquals(12345, result.getValue());</pre>
<p>And when you try to compile your project it produces a compilation error like this:</p>
<p><span style="color: #0000ff;">/projects/myapp/src/test/java/org/myapp/MyTest.java:[88,8] reference to assertEquals is ambiguous, both method assertEquals(double,double) in org.junit.Assert and method assertEquals(java.lang.Object,java.lang.Object) in org.junit.Assert match</span></p>
<p>Since JUnit offer several methods that are very similar the compiler can not always determine which one to use. In our case we have the number 12345 which is an int and result.getValue() which is an Integer. You&#8217;d think that the compiler could figure out to convert the number 12345 to an Integer object which would give us a match on &#8220;assertEquals(java.lang.Object, java.lang.Object) method, but instead it throws the above error.</p>
<p>The reason for this is that Java uses best match to try to determine the method that will require the least conversion of the parameters. In this case one method requires boxing, and the other method would require un-boxing. Both of these methods have equal priority and that&#8217;s why there is ambiguity since none of the methods are more specific than the other.</p>
<p>The solution is to help the compiler determine what it need to do. We can do that using this:</p>
<pre>assertEquals(12345, (int) result.getValue());</pre>
<p>or this:</p>
<pre>
<pre>assertEquals((Integer)12345, result.getValue());</pre>
</pre>
<p>to resolve this problem. The second solution that converts 12345 to an Integer object is most likely the better once since Java will auto-box a null value to the number 0 which may not be the correct behavior for the class you&#8217;re testing.</p>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/java-primitive-data-type-sizes-for-byte-short-int-long-float-double-and-char/' rel='bookmark' title='Permanent Link: Java primitive data type sizes for byte, short, int, long, float, double and char'>Java primitive data type sizes for byte, short, int, long, float, double and char</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/junit-4-error-reference-to-assertequals-is-ambiguous/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Spring XML and defining end of line characters in a bean property</title>
		<link>http://www.btaz.com/java/spring-xml-and-defining-end-of-line-characters-in-a-bean-property/</link>
		<comments>http://www.btaz.com/java/spring-xml-and-defining-end-of-line-characters-in-a-bean-property/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 15:52:20 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=63</guid>
		<description><![CDATA[If you need to define and end of line character (EOL) like \n in your Spring XML files in a bean property you can&#8217;t do this
&#60;bean id="some-bean-id" class="some-class"&#62;
    &#60;property name="my-property-name" value="\n"/&#62;
&#60;/bean&#62;
This simply wont work. You&#8217;ll end up with a backslash followed by the letter n. What you have to do is to [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/' rel='bookmark' title='Permanent Link: Want to use Spring 3.0 milestone release from Maven?'>Want to use Spring 3.0 milestone release from Maven?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you need to define and end of line character (EOL) like \n in your Spring XML files in a bean property you can&#8217;t do this</p>
<pre>&lt;bean id="some-bean-id" class="some-class"&gt;
    &lt;property name="my-property-name" value="\n"/&gt;
&lt;/bean&gt;</pre>
<p>This simply wont work. You&#8217;ll end up with a backslash followed by the letter n. What you have to do is to use an escape character like this</p>
<pre>&lt;bean id="some-bean-id"&gt;
    &lt;property name="my-property-name" value="&amp;#10;"/&gt;
&lt;/bean&gt;</pre>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/' rel='bookmark' title='Permanent Link: Want to use Spring 3.0 milestone release from Maven?'>Want to use Spring 3.0 milestone release from Maven?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/spring-xml-and-defining-end-of-line-characters-in-a-bean-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven, Log4j and javax.jms</title>
		<link>http://www.btaz.com/java/maven-log4j-and-javax-jms/</link>
		<comments>http://www.btaz.com/java/maven-log4j-and-javax-jms/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 15:37:50 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[jar files]]></category>
		<category><![CDATA[jms]]></category>
		<category><![CDATA[jmx]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[pom.xml]]></category>
		<category><![CDATA[unable to find resource]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=59</guid>
		<description><![CDATA[Log4j version 1.2.15 added features which has new dependencies on sun and javax packages. When you try to build your project using Maven and log4j 1.2.15 you will see this:
[INFO] Unable to find resource 'com.sun.jmx:jmxri:jar:1.2.1' in repository central (http://repo1.maven.org/maven2)
[INFO] Unable to find resource 'com.sun.jdmk:jmxtools:jar:1.2.1' in repository central (http://repo1.maven.org/maven2)
[INFO] Unable to find resource 'javax.jms:jms:jar:1.1' in repository [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/' rel='bookmark' title='Permanent Link: Want to use Spring 3.0 milestone release from Maven?'>Want to use Spring 3.0 milestone release from Maven?</a></li>
<li><a href='http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/' rel='bookmark' title='Permanent Link: How to find project dependencies in a Maven project'>How to find project dependencies in a Maven project</a></li>
<li><a href='http://www.btaz.com/java/maven/18/' rel='bookmark' title='Permanent Link: Maven pom.xml structure'>Maven pom.xml structure</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Log4j version 1.2.15 added features which has new dependencies on sun and javax packages. When you try to build your project using Maven and log4j 1.2.15 you will see this:</p>
<pre>[INFO] Unable to find resource 'com.sun.jmx:jmxri:jar:1.2.1' in repository central (http://repo1.maven.org/maven2)
[INFO] Unable to find resource 'com.sun.jdmk:jmxtools:jar:1.2.1' in repository central (http://repo1.maven.org/maven2)
[INFO] Unable to find resource 'javax.jms:jms:jar:1.1' in repository central (http://repo1.maven.org/maven2)</pre>
<p>These packages are not in the Maven repositories due to licensing issues. There are two simple solutions to this problem. You can either modify your pom.xml file to use the previous version of log4j (log4j 1.2.14) which doesn&#8217;t depend on the JMX and JMS packages:</p>
<pre>&lt;dependency&gt;
    &lt;groupId&gt;log4j&lt;/groupId&gt;
    &lt;artifactId&gt;log4j&lt;/artifactId&gt;
    &lt;version&gt;1.2.14&lt;/version&gt;
&lt;/dependency&gt;</pre>
<p>Or you can exclude the dependencies with the caveat that some of the lo4gj appenders  that depend on these packages wont be available</p>
<pre>&lt;dependency&gt;
    &lt;groupId&gt;log4j&lt;/groupId&gt;
    &lt;artifactId&gt;log4j&lt;/artifactId&gt;
    &lt;version&gt;1.2.15&lt;/version&gt;
    &lt;exclusions&gt;
        &lt;!--
        These packages are not in the Maven repository
        If you do this certain log4j appenders will not be available
        --&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;javax.jms&lt;/groupId&gt;
            &lt;artifactId&gt;jms&lt;/artifactId&gt;
        &lt;/exclusion&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt;
            &lt;artifactId&gt;jmxtools&lt;/artifactId&gt;
        &lt;/exclusion&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt;
            &lt;artifactId&gt;jmxri&lt;/artifactId&gt;
        &lt;/exclusion&gt;
    &lt;/exclusions&gt;
&lt;/dependency&gt;</pre>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/want-to-use-spring-3-0-milestone-release-from-maven/' rel='bookmark' title='Permanent Link: Want to use Spring 3.0 milestone release from Maven?'>Want to use Spring 3.0 milestone release from Maven?</a></li>
<li><a href='http://www.btaz.com/java/how-to-find-project-dependencies-in-a-maven-project/' rel='bookmark' title='Permanent Link: How to find project dependencies in a Maven project'>How to find project dependencies in a Maven project</a></li>
<li><a href='http://www.btaz.com/java/maven/18/' rel='bookmark' title='Permanent Link: Maven pom.xml structure'>Maven pom.xml structure</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/maven-log4j-and-javax-jms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to read environment variables in Java</title>
		<link>http://www.btaz.com/java/how-to-read-environment-variables-in-java/</link>
		<comments>http://www.btaz.com/java/how-to-read-environment-variables-in-java/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 05:50:28 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[-D]]></category>
		<category><![CDATA[getenv]]></category>
		<category><![CDATA[getProperty]]></category>
		<category><![CDATA[system property]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=47</guid>
		<description><![CDATA[You can set environment variables or pass them in using the -Dvariablename syntax
SET logfile=/location/to/my/log/file.log
or
java -Dlogfile=/location/to/my/log/file.log HelloWorld
When you want to access these environment variables from your Java source file you can use
Java 1.5 and newer:

String logfileLocation = System.getenv("logfile");

Java 1.4 and older:
String logfileLocation = System.getProperty("logfile");


Related posts:Java and the current work directory



Related posts:<ol><li><a href='http://www.btaz.com/java/java-and-the-current-work-directory/' rel='bookmark' title='Permanent Link: Java and the current work directory'>Java and the current work directory</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>You can set environment variables or pass them in using the -Dvariablename syntax</p>
<pre>SET logfile=/location/to/my/log/file.log</pre>
<p>or</p>
<pre>java -Dlogfile=/location/to/my/log/file.log HelloWorld</pre>
<p>When you want to access these environment variables from your Java source file you can use</p>
<p><strong>Java 1.5 and newer:</strong></p>
<pre>
<pre>String logfileLocation = System.getenv("logfile");</pre>
</pre>
<p><strong>Java 1.4 and older:</strong></p>
<pre>String logfileLocation = System.getProperty("logfile");</pre>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/java-and-the-current-work-directory/' rel='bookmark' title='Permanent Link: Java and the current work directory'>Java and the current work directory</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/how-to-read-environment-variables-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What jar file does a Java class belong to?</title>
		<link>http://www.btaz.com/java/what-jar-file-does-a-java-class-belong-to/</link>
		<comments>http://www.btaz.com/java/what-jar-file-does-a-java-class-belong-to/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 17:18:01 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ClassNotFoundException]]></category>
		<category><![CDATA[jar files]]></category>
		<category><![CDATA[java class files]]></category>
		<category><![CDATA[NoClassDefFoundError]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=45</guid>
		<description><![CDATA[I found this very useful web site that allows you to search what JAR file a specific Java class belongs to. This has proven quite useful to me over the last couple of days when I had to deal with NoClassDefFoundError and ClassNotFoundException problems.
You can just enter the name of the class or JAR file [...]


Related posts:<ol><li><a href='http://www.btaz.com/java/junit-4-error-reference-to-assertequals-is-ambiguous/' rel='bookmark' title='Permanent Link: JUnit 4 error: reference to assertEquals is ambiguous'>JUnit 4 error: reference to assertEquals is ambiguous</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I found this very useful web site that allows you to search what JAR file a specific Java class belongs to. This has proven quite useful to me over the last couple of days when I had to deal with NoClassDefFoundError and ClassNotFoundException problems.</p>
<p>You can just enter the name of the class or JAR file your looking for and the site will display the result.</p>
<p><a href="http://www.findjar.com/index.jsp" target="_blank">http://www.findjar.com/index.jsp</a></p>


<p>Related posts:<ol><li><a href='http://www.btaz.com/java/junit-4-error-reference-to-assertequals-is-ambiguous/' rel='bookmark' title='Permanent Link: JUnit 4 error: reference to assertEquals is ambiguous'>JUnit 4 error: reference to assertEquals is ambiguous</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/what-jar-file-does-a-java-class-belong-to/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mockito an alternative to JMock</title>
		<link>http://www.btaz.com/java/mockito-an-alternative-to-jmock/</link>
		<comments>http://www.btaz.com/java/mockito-an-alternative-to-jmock/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 05:35:22 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://www.btaz.com/?p=38</guid>
		<description><![CDATA[I&#8217;ve used JMock for quite some time and I&#8217;ve found it to be a great and very useful mocking framework for unit testing. I was never quite happy with the syntax though; especially the part where you specify expectations.  Here&#8217;s a JMock snippet illustrating an expectation and a return value from a mocked object
context.checking(new Expectations() [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used JMock for quite some time and I&#8217;ve found it to be a great and very useful mocking framework for unit testing. I was never quite happy with the syntax though; especially the part where you specify expectations.  Here&#8217;s a JMock snippet illustrating an expectation and a return value from a mocked object</p>
<pre><span style="color: #0000ff;">context.checking(new Expectations() {{
    oneOf (department).employees(); will(returnIterator(employees));
}});</span></pre>
<p>In Mockito the equivalent code would look like this</p>
<pre><span style="color: #0000ff;">when(department.employees()).thenReturn(employees);</span></pre>
<p>I find the Mockito syntax to be easier to write and understand. I&#8217;ve seen fellow developers implement JMock expectations in a way where they actually didn&#8217;t perform a useful test, and I think the sometimes confusing syntax of JMock was the reason. I&#8217;m not dismissing <a href="http://www.jmock.org/">JMock</a> as an inferior mocking framework, but I do think that the learning curve is a bit steeper. If you haven&#8217;t used <a title="Mockito" href="http://www.mockito.org/">Mockito</a> yet I encourage you to take a look at it.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.btaz.com/java/mockito-an-alternative-to-jmock/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
