programming patterns

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.
Syndicate content