Java

Java Single Application Instance

Java
A single instance application is one that only allows for 1 of the application to run no matter how many times the user tries to launch.  Windows and linux native applications have an API to detect the instance of an application but when in Java, it is not quite as easy or reliable.  To complicate matters, often times the requirement will be for the original application instance to react in some way to the launch, as in bringing the window to the front, opening a file or displaying a message.

Fortunately it's not all that difficult to code this if you know the trick.  In this article I'll give you all the code you need to copy and paste into your application to make it single instance.

Advanced Typesafe Command Pattern using Java Generics

Java
If you have a need to use the command pattern and want to have a standard interface but with type safe parameters, I have come up with a solution.  This is one of the most interesting uses (or hacks) of generics I've ever seen or come up with and being that it took a little bit of deep thought to get worked out, I'd like to share it with you all.

Using Hibernate with Google Web Toolkit (GWT)

Java

Hibernate is an excellent tool which saves many projects from substantial amounts of code.  Gone are the days of writing massive datasource layers full of obnoxious JDBC code.  As gravy you also get simple query objects, caching, connection pooling and countless other great features.  GWT on the other hand provides a robust API using a revolutionary new paradigm for writing javascript and complex dhtml interfaces.  The latest version of Hibernate supports annotations, meaning you can ditch all of the XML that was previously required.  This feature of course requires Java 5 to support annotations.  Unfortunately, as of GWT 1.4, only Java 1.4 is supported on the client-side.  I have created a solution to bridge the Java 1.4 to Java 5.0 gap.

Syndicate content