Pages tagged "java"

Bizarre Jetty NoClassDefFoundError demystified

Mysterious question

It was the Christmas code freeze of 2013. We had successfully upgraded our production servers to Jetty 9. Us developers were quite content about not having to maintain the app for an extended period of time. However, none of us had anticipated the mysterious errors that would eventually consume the better parts of our holidays.

17 Mar 2015

Too many open files

Too many open files

We had just upgraded our application to the latest version of Grails. Once deployed, our Jetty servers started mysteriously crashing just after a few hours of routine testing, complaining about “Too many open files”.

After some preliminary Google searches we found out that this problem could be alleviated temporarily by…

13 Jan 2015

CF - A fast Java Class Finder

What is it with class finders these days? Everyone seems to have their own version of the tool. From naive programmers creating crude forms to large organizations with fairly sophisticated ones. Through this article, I present my little implementation of the product.

But before you explore further, I have a few claims to make. I have tried my best to bridge the many mutual exclusivities exhibited by similar products in the realm.

22 Jun 2008

Static Initializer and Blank Final Problem in Java

Greetings folks! Here I’m with yet another interesting situation in Java that I stumbled upon.

The situation is simple. I have two class level (static) blank final variables declared. As we all know, for the class to compile, we must initialize these variables in a static initializer block. Fair enough. Now, I will initialize the first variable the normal way. However…

21 Jun 2008

Simple Implementation of Wildcard Text Matching using Java

The quick brown fox jumps over the lazy dog

What if you had to implement a text matching logic in Java that would result in an affirmation for search strings such as Th*ick*b*ox*over the*dog, *fox*dog and a negative for ones such as *fox*brown and *abcd*?

I faced a similar challenge few days back as part of another tool I was working on. I wanted a simple solution that not only worked but worked faster. Using a regular expression wasn’t feasible as the search pattern was dynamic and hence, precompiling the expression for faster performance was ruled out.

I thought for a while and arrived at this solution. Hope it helps some hapless programmer like me slogging the night out in some corner of the globe.

13 May 2008

Args Engine - A reusable solution for Command Line Arguments Parsing in Java

Args Engine is a simple command line parsing engine for Java. The library has a single class and can be imported into any project of your choice easily. The only prerequisite, however, is that Java 1.5 or higher is required for the library to work.

This library works for applications which need to parse either (or both) short form (e.g. -h) or long form (e.g. --help) command line options. It also supports parsing valued options with the assumption that the value for an option follows the option itself (as in -out /usr/myhome/result.log).

12 May 2008

RARoScope - Java Library for Scanning RAR Files

Ever faced the challenge of having to be able to scan RAR archives using Java? Wished the API was as simple and easy to use as the ones provided for ZIP and JAR handling in Java? Don't want the hassles of including expensive native code into your Java application?

RARoScope is here to solve all these woes.

17 Mar 2008

Throwing null instead of an Exception in Java

As it's usual these days, I was spending the evening doing some extremely interesting programming in Java. It occurred to me all of a sudden, if we could compile a Java program if it threw nulls instead of exceptions!

11 Mar 2008

Fun with XMPP and Google Talk

Ethereal screenshot

Have you ever wondered when signing into Google Talk, what might be happening under the hood? How can it tell you that your friend is typing just as she has, in fact, started typing? How does it manage to show all that real time presence information?

Well, one day I got really curious and decided to open it up! In this two part article, I share my adventures as I unravel the way Google Talk does what it is best at — Communication.

29 Oct 2007

Recursive Java Decompiler

Often we encounter situations where the only solution to a certain Java problem is to decompile the contents of an entire JAR file, edit the resulting the source, rebuild and repackage before using.

I searched a lot for decompilers which could recursively decompile multiple class files while preserving the package hierarchy, but in vain. So, I thought of writing a Windows batch script myself, to do what I was looking for. This script is also known as JAR decompiler or recursive JAD.

30 May 2007

Very Long File Names in Windows

We had a strange problem one day when we were trying to deploy an Enterprise Application on WebSphere™ Application Server installed on a Windows XP machine. The application was never getting deployed although it was a perfectly valid one with no errors whatsoever. Just before the application would be deployed completely, a FileNotFoundException was being thrown for the EJB deployment descriptor. D:\IBM\..214 characters more ..\ibm-ejb-jar-bnd.xmi (The system cannot
find the path specified)
    at Method)
    at Code))
21 Feb 2005