in Java, Matching

the same old mistakes

Well, two days two entries, not bad eh.  This one will be short though, because I’m still feeling pretty tired.  Which is one of the points I want to make actually.  After a year of, how can I say it, managing my own time?  I’m now back in the unreal world of real work.  I hate getting up in the morning though.  I don’t mind so much when the sun is shining but when it’s pissing it down there just feels little incentive.  More so in the heart of winter when the sun doesn’t come up until 9am.  The pleasures of living in Scotland.  I have no issues with getting up at 10am but 9am or before is just a day breaker.

So I hear you say, what is this work I hear you talk about?   Well for the next six months I will be working for Glasgow University creating/maintaining/living matching software (maybe I will write a post about what I will be doing – when I finally figure that out). I have actually been working for around a week now, bizarrely enough though I still have not really been in. That is a long story I won’t go into. None-the-less I have been doing a fair amount of work, which leads me to my point.

After a few years of (self-imposed) exile from using Java, the tempestuous love affair has been rekindled in the last week. The majority of the stuff within the department I’m working in is implemented in C# but I was struggling to find a constraint programming toolkit that could be used with C#. However, I must make the same mistakes again and again when I go back to Java. That is, without fail, I get “java.lang.NoClassDefFoundError: AppName” when running the application, despite setting the correct classpath on the command line. And without fail I sit pissing around with the command trying every possible permutation to get it to work. Then, the bell rings, and I remember this happens to me every time, and the solution presents itself (usually about 2 hours wasted).

So the problem: well I like to use cygwin as my terminal in windows, simply because it looks and feels nicer than a dirty old windows command prompt. However, the java command that I pick up on my path in the cygwin installation is the windows version, and as a consequence doesn’t understand the path separator in the classpath parameter, e.g. it understands neither java -classpath .:./lib/log4j.jar AppName nor java -classpath .;./lib/log4j.jar. With the first command the java application just thinks .:./lib/log4j.jar is the full path and on the second it treats the ; as the end of the first command. The solution? Well for me it was just to use windows command prompt, where everything worked fine. For others it will be to use the cygwin version of java (which I assume is available but have not checked). The latter means managing two version of java on my system which seemed enough work to warrant not doing it. Instead I prefer to waste half my day typing ls into the command prompt.

Write a Comment


  1. I tried briefly using it but it didn’t work on first couple of goes so gave up. I was probably doing something else wrong as well though. Then when I got it working on the command prompt I just thought bugger it, why bother!