Friday, June 17, 2011

Cygwin Java and Classpath Problem

" The cygpath program is a utility that converts Windows native filenames to Cygwin POSIX-style pathnames and vice versa. "
-- Cygwin Utilities

If you are trying to run a Java Class using a Shell Script running off Cygwin, you are sure to see a ClassNotFoundException.

The problem is due to these :-

  • java.exe is a Windows executable program
  • java.exe expects its paths & classpaths to be in the Windows Format - paths separated by semi-colon ( ; )
  • Cygwin wants its paths in the LINUX Format - paths separated by a colon ( : )
Ok, we know the problem now and here's a quick fix solution if you are running Shell Scripts off Cygwin :-

CLASSPATH=.:../lib/junit.jar:../lib/weblogic.jar:../lib/ojdbc6.jar

# Convert paths to help cygwin see Classpaths
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`

java -classpath "$CLASSPATH" com.test.PreLoadTester

Please be sure not to check this into a Production environment - cygpath is only available as part of the Cygwin Utilities.

Monday, June 13, 2011

Three Key Tools

"We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris."
-- LarryWall

If you are a Developer ( to quote a phrase overused recently by Head Hunters - " Hand On Developer " ), & if you are using Windows for all your development activities, you'd better have these three tools in your kit.

What do these Tools do ? Well, they solve some of the most nagging & frustrating problems that you always run into.

Please take a look at Sundar's Blog for more about these goodies. And, keep an eye on his Blog for more of these goodies.

Back After a long Hiatus !

Time is very slow for those who wait Very fast for those who are scared very long for those who lament Very short for those who celebrate But for those who love time is eternal"
— William Shakespeare

Ok, I am back to Blogging after a long Hiatus. During the space in time, I underwent a good lot of challenges - personal & professional - that demanded more than a fair share of my time.

Anyways, back to Blogging - as they say:-

" You can either be the sun that provides the light, or the mirror that reflects it."

Its time to do my share as a humble mirror and reflect the light of knowledge - any streak of light that I stumble upon.