<?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>Cinq Software &#187; java</title>
	<atom:link href="http://cinq.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://cinq.com</link>
	<description>my code</description>
	<lastBuildDate>Tue, 27 Jul 2010 18:30:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to find the jdk version used to compile a java class</title>
		<link>http://cinq.com/2010/07/23/how-to-find-the-jdk-version-used-to-compile-a-java-class/</link>
		<comments>http://cinq.com/2010/07/23/how-to-find-the-jdk-version-used-to-compile-a-java-class/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 20:35:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=95</guid>
		<description><![CDATA[I spent a little bit of time to figure out how to find the jdk version used to compile a java class. On the site stackoverflow they have a great example of java code that can get this information. Unfortunately that did not resolve my problem so I will have to hunt down a bit [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a little bit of time to figure out how to find the jdk version used to compile a java class. On the <a href="http://stackoverflow.com/questions/1293308/java-api-to-find-out-the-jdk-version-a-class-file-is-compiled-for">site stackoverflow they have a great example of java code</a> that can get this information. Unfortunately that did not resolve my problem so I will have to hunt down a bit more on why I get this:</p>
<p>Exception in thread &#8220;main&#8221; java.lang.UnsupportedClassVersionError: Bad version number in .class file<br />
at java.lang.ClassLoader.defineClass1(Native Method)<br />
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)<br />
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)<br />
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)<br />
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)<br />
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)<br />
at java.security.AccessController.doPrivileged(Native Method)<br />
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)<br />
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)<br />
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)<br />
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)<br />
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)</p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2010/07/23/how-to-find-the-jdk-version-used-to-compile-a-java-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sun Java in KUbuntu</title>
		<link>http://cinq.com/2009/12/30/sun-java-in-kubuntu/</link>
		<comments>http://cinq.com/2009/12/30/sun-java-in-kubuntu/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 15:50:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[kubuntu]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=69</guid>
		<description><![CDATA[That was not an obvious one. Under KUbuntu I typically use the KPackageKit application to install and update applications.  It did not work well. I tried to install the sun-java-jdk package many times and every time it would list the dependencies and do the install but the &#8220;java -version&#8221; would tell me that I was [...]]]></description>
			<content:encoded><![CDATA[<p>That was not an obvious one. Under KUbuntu I typically use the KPackageKit application to install and update applications.  It did not work well. I tried to install the sun-java-jdk package many times and every time it would list the dependencies and do the install but the &#8220;java -version&#8221; would tell me that I was still using the OpenJDK.</p>
<p>After reading a few different posts in forums I tested the idea to use the synaptic package manager. The installation worked much better.</p>
<p>To finalize the install I ran a few commands at the cli:</p>
<p><strong>sudo update-java-alternatives -l</strong></p>
<p>This listed the fact that I now have the OpenJDK and Sun Java installed on my workstation.</p>
<p><strong>sudo update-alternatives &#8211;config java</strong></p>
<p>This allowed me to specify to use the Sun Java as my default JVM.</p>
<p><strong>java -version </strong></p>
<p>This now reports the Sun Java JRE as my JVM.</p>
<p>I can now use Maven to compile some test projects.</p>
<p>I guess there are still a few issues with the OpenJDK to be fully compatible (might just be some configuration that I am not aware of).</p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2009/12/30/sun-java-in-kubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Decompiler</title>
		<link>http://cinq.com/2009/09/03/java-decompiler/</link>
		<comments>http://cinq.com/2009/09/03/java-decompiler/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 14:12:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=57</guid>
		<description><![CDATA[This is not the first time I do this and it is on the edge of embarrassing except this time I knew I had tools to get me out: lose the source code to a java application. I have this application that was done a year ago and I guess that in the rush to [...]]]></description>
			<content:encoded><![CDATA[<p>This is not the first time I do this and it is on the edge of embarrassing except this time I knew I had tools to get me out: lose the source code to a java application.</p>
<p>I have this application that was done a year ago and I guess that in the rush to get it to production I forgot to import the code in SVN.</p>
<p>A year later we have changed a few things and now I have to change a few lines in the code and add a method to it.</p>
<p>I remembered using a command line tool under Linux to decompile but since I could not remember the name of it I had to search for it. In the first few results of my google search for &#8220;java decompiler&#8221; came this site:</p>
<p><a title="JD" href="http://java.decompiler.free.fr/" target="_blank">http://java.decompiler.free.fr/</a></p>
<p>I tried to install the JD-Eclipse but I don&#8217;t see how to use it so I simply downloaded and used the JD-Gui for Linux and it works beautifully. I can see my source code in the .class file in 2 seconds and now I can easily change it. This is so convenient.</p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2009/09/03/java-decompiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New programming Style</title>
		<link>http://cinq.com/2009/08/18/new-programming-style/</link>
		<comments>http://cinq.com/2009/08/18/new-programming-style/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 11:40:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=50</guid>
		<description><![CDATA[Saw this article from a twit and I am unsure how I can do all these: http://codemonkeyism.com/generation-java-programming-style/ Interesting and if I do any code with this I will post an other entry to let you know how it went.]]></description>
			<content:encoded><![CDATA[<p>Saw this article from a twit and I am unsure how I can do all these:</p>
<p><a href="http://codemonkeyism.com/generation-java-programming-style/">http://codemonkeyism.com/generation-java-programming-style/</a></p>
<p>Interesting and if I do any code with this I will post an other entry to let you know how it went.</p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2009/08/18/new-programming-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java MVC</title>
		<link>http://cinq.com/2009/06/09/java-mvc/</link>
		<comments>http://cinq.com/2009/06/09/java-mvc/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 01:48:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Java MVC]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=45</guid>
		<description><![CDATA[I have to read a bit more on the subject but this article was interesting since it shows how to do in Java what Apple Cacao does with the MVC model. I find this twist to be easier to understand. http://java.sun.com/developer/technicalArticles/javase/mvc/]]></description>
			<content:encoded><![CDATA[<p>I have to read a bit more on the subject but this article was interesting since it shows how to do in Java what Apple Cacao does with the MVC model. I find this twist to be easier to understand.</p>
<p><a href="http://java.sun.com/developer/technicalArticles/javase/mvc/">http://java.sun.com/developer/technicalArticles/javase/mvc/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2009/06/09/java-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Anti-Pattern</title>
		<link>http://cinq.com/2009/05/05/java-anti-pattern/</link>
		<comments>http://cinq.com/2009/05/05/java-anti-pattern/#comments</comments>
		<pubDate>Tue, 05 May 2009 14:28:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=39</guid>
		<description><![CDATA[http://odi.ch/prog/design/newbies.php This explains a few things that should be done differently if you want your application to perform well. Very interesting!]]></description>
			<content:encoded><![CDATA[<p><a href="http://odi.ch/prog/design/newbies.php">http://odi.ch/prog/design/newbies.php</a></p>
<p>This explains a few things that should be done differently if you want your application to perform well. Very interesting!</p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2009/05/05/java-anti-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java keytool quick notes</title>
		<link>http://cinq.com/2009/05/05/java-keytool-quick-notes/</link>
		<comments>http://cinq.com/2009/05/05/java-keytool-quick-notes/#comments</comments>
		<pubDate>Tue, 05 May 2009 14:21:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=36</guid>
		<description><![CDATA[I have been playing with SSL connections between a Java application and a server lately and understanding the keytool command has helped troubleshooting. So here are my quick notes: To list the content of a keystore you simply use this command: keytool -v -list -keystore keystoreFileName It is useful to remember that the default keystore [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing with SSL connections between a Java application and a server lately and understanding the keytool command has helped troubleshooting. So here are my quick notes:</p>
<p>To list the content of a keystore you simply use this command:</p>
<p>keytool -v -list -keystore keystoreFileName</p>
<p>It is useful to remember that the default keystore is in the $JAVA_HOME/ jre/lib/security/cacerts file and that the default password for it is &#8220;changeit&#8221;.</p>
<p>I also used the printcert command to list the content of some certificate:</p>
<p>keytool -printcert -v -file entrust.cer</p>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2009/05/05/java-keytool-quick-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swing Explorer</title>
		<link>http://cinq.com/2008/05/06/swing-explorer/</link>
		<comments>http://cinq.com/2008/05/06/swing-explorer/#comments</comments>
		<pubDate>Wed, 07 May 2008 01:29:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://cinq.com/?p=24</guid>
		<description><![CDATA[I was reading an article today about this piece of software and I taught that it was quite interesting. You can see all the parts of a swing application in this swing debugger. For someone like me that is not always sure how all the parts are linked together it is a quick visual view. [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading an article today about this piece of software and I taught that it was quite interesting. You can see all the parts of a swing application in this swing debugger. For someone like me that is not always sure how all the parts are linked together it is a quick visual view. Worth a try for sure.</p>
<p>Ref:</p>
<ul>
<li><a href="https://swingexplorer.dev.java.net/">https://swingexplorer.dev.java.net/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2008/05/06/swing-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first Servlet</title>
		<link>http://cinq.com/2007/01/01/my-first-servlet/</link>
		<comments>http://cinq.com/2007/01/01/my-first-servlet/#comments</comments>
		<pubDate>Tue, 02 Jan 2007 00:23:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://cinq.com/wptest/2007/01/01/my-first-servlet/</guid>
		<description><![CDATA[Servlet programming has always been something I was curious about. Starting this project was a bit ackward since there is plenty of documentation but nothing to hold your hand in what I was looking at. Too much struggling convinced me to write down how to do it for a very simple servlet so I could [...]]]></description>
			<content:encoded><![CDATA[<p>Servlet programming has always been something I was curious about. Starting this project was a bit ackward since there is plenty of documentation but nothing to hold your hand in what I was looking at. Too much struggling convinced me to write down how to do it for a very simple servlet so I could go from there.I used Eclipsei 3.1 as my Java IDE and I use Tomcat 5.5.x as my Servlet Application Server.</p>
<ol>
<li> <strong>Creating a new project in Eclipse</strong><br />
This should be a basic task that is quite easy. I called my new project HelloWorldServlet (great craetive title). I then created a new class named &#8220;HelloWorldServlet&#8221;. This opens the HelloWordlServlet.java file in the editor and I entered this source code in it:</p>
<pre>import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorldServlet extends HttpServlet
{
    static final long serialVersionUID = 1;

    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
        {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("");
            out.println("");
            out.println("Hello World through a servlet!");
            out.println("");
            out.println("");
        }

}</pre>
</li>
<li> <strong>Importing the servlet library</strong>Something that took me a little while to figure out is that I needed to add the servlet library from Tomcat to be able to properly compile but to also get the proper dynamic help in the Eclipse IDE. Under my working space directory I have a lib directory where I copy the common libraries that I use. The Tomcat servlet-api.jar was copied over there. You then simply right-click on your project in Eclipse, go to &#8220;Build Path&#8221; and click on &#8220;Add External Archives&#8221;. You simply browse to where you have copied servlet-api.jar and you now have the library imported.</li>
<li><strong>Unknown tidbit</strong>After adding this external archive it highlighted the fact that I need to have a &#8220;static final long serialVersionUID&#8221;. This is for the serialization of the object but I am not sure what value, if unique, it should have. I only added it as I was told without looking for too many answers right away.</li>
<li><strong>Compiled and copied</strong>I compiled (ctrl-b) my servlet and copied it to my Tomcat box. Under the Tomcat default directory there is a webapps directory where you have to install your application. I made a new directory simply called &#8220;HelloWorld&#8221;. Under that directory I created a &#8220;WEB-INF&#8221; directory. Under the WEB-INF directory I created a &#8220;classes&#8221; directory where I copied my .class.
<p>The directory structure currently looks like this:</p>
<pre>tomcat
  +--&gt;webapps
         +--&gt;HelloWorld
                   +--&gt;WEB-INF
                          +--&gt;classes
                                     HelloWorldServlet.class</pre>
</li>
<li><strong>Application declaration</strong> In the WEB-INF directory I had to create a web.xml file containing this: <xmp>&lt;br&gt;&amp;amp;lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&amp;amp;gt;&lt;br&gt;&amp;amp;lt;!DOCTYPE web-app&lt;br&gt;    PUBLIC &#8220;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&#8221;&lt;br&gt;    &#8220;http://java.sun.com/dtd/web-app_2_3.dtd&#8221;&amp;amp;gt;&lt;br&gt;&amp;amp;lt;web-app&amp;amp;gt;&lt;br&gt; &amp;amp;lt;servlet&amp;amp;gt;&lt;br&gt;  &amp;amp;lt;servlet-name&amp;amp;gt;HelloWorldServlet&amp;amp;lt;/servlet-name&amp;amp;gt;&lt;br&gt;  &amp;amp;lt;servlet-class&amp;amp;gt;HelloWorldServlet&amp;amp;lt;/servlet-class&amp;amp;gt;&lt;br&gt; &amp;amp;lt;/servlet&amp;amp;gt;&lt;br&gt; &amp;amp;lt;servlet-mapping&amp;amp;gt;&lt;br&gt;  &amp;amp;lt;servlet-name&amp;amp;gt;HelloWorldServlet&amp;amp;lt;/servlet-name&amp;amp;gt;&lt;br&gt;  &amp;amp;lt;url-pattern&amp;amp;gt;/HelloWorldServlet&amp;amp;lt;/url-pattern&amp;amp;gt;&lt;br&gt; &amp;amp;lt;/servlet-mapping&amp;amp;gt;&lt;br&gt;&amp;amp;lt;/web-app&amp;amp;gt;&lt;br&gt;</xmp>
<p>This file declares my servlet name, class name and URI. Since everything is the same here it is quite simple.</li>
<li><strong>Calling the application</strong>The fun part (when it works) is calling the application and seeing the end result. Since I have already declared in my web.xml that the URI is HelloWordlServlet calling it in my browser was as simple as entering &#8220;http://serverName/HelloWordlServlet/&#8221;.</li>
<li><strong>A few more notes</strong>Because I was not perfect on the first try I had to reload my application after each change I made to the class file or to the web.xml. Important to reload otherwise the cached version is what you keep seeing.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://cinq.com/2007/01/01/my-first-servlet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
