There seems to be 15 questions about how to use `Scanner` on Stackoverflow every day. Probably some new text book this year is causing this torrent of craptastic questions from anonymous students. Here is how you do it! I started my own question to address all the most basic usages.
The argument rages on still to this day about checked exceptions in Java. Personally I think they have always been a bad idea. Python gets along fine without checked exceptions, and I love me some Python. The Java developers don’t even get the concept of checked exceptions correct most of the time and the SDK… Read the full article
The following is the source code for a javax.management.ObjectName serializer that recursively serializes and is a good example of how to avoid circular references. This is specifically aimed at dumping the DomainRuntimeServiceMBean and the RuntimeServiceMBean servers from Weblogic 11g, but it should work with any JMX standards compliant MBServer implementations.
This some considerable noise on the internet about Fluent APIs and using them. There was a question on stackoverflow.com about how to enforce calling all the required methods to guarantee you fully materialize an object when using a Builder Pattern with a Fluent API approach. The appropriate way to achieve this is through Interfaces that… Read the full article
Where is final used? There are a lot of Java developers that don’t understand the keyword final. The keyword final is one of your greatest allies in writing bug free maintainable code. It makes reading code much more deterministic and step debugging a breeze. And it makes your code side effect free. Side effects are… Read the full article
I have released my first Maven artifacts to the Central Repository through Sonatype’s Open Source Nexus Server. You have to jump through some hoops to get everything just right to be able to release to the Sonatype Nexus repository, and I could not find all the information I needed in one place so I will… Read the full article
Make your pom.xml dependency entry for Jasper Reports look like this If you don’t use the excludes directive you get the java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference error.
I have created my first Maven 2 / 3 Archetype for generating command line applications that are powered by Java Simple Argument Parser ( JSAP ). Its source code lives on GitHub. I am working on getting it posted to Sonatype and synced to Central Repository.
I saw this post on StackOverflow and thought I would whip up a quick Object Oriented solution using Generics using the Chain of Responsibility Pattern. This was a quick exercise to see how it might look. There are many other ways that this could be implemented, like using Dependency Injection to supply the implementations of… Read the full article
Sometimes you want to load data at runtime from inside a .jar file or .war file to populate at List or Map or something. Here is how to do that easily. Just make sure that your data file is in the same package along side the Class that is loading it, or refer to it… Read the full article