Saturday, December 16, 2006

Java SE 6 Trouble Shooting Guides

Ever since I tried Java back in 2000, I have felt a little uncomfortable about the not-so-powerful and not-so-intuitive set of tools accompanying JDKs. That was one of the reasons why I didn't pursue my interests seriously in programming in Java. But the notions are changing and I mean it.

From the hoopla going on about Java SE 6, I was tempted to try that. Hence you might be seeing some Java SE 6 specific posts in future too. There are a lot of powerful tools (jhat and jmap for instance) that are bundled in this SE for the pleasure of the system programmer.

I came across this excellent list of tutorials when I was browsing through Mandy Chung's blog. She is the person leading the Java Management & Monitoring Tools API (java.lang.management) effort. You would find this list of tutorials extremely useful. Though most of them are specific to Java SE 6, I guess some of them should be applicable to earlier JSEs too.

Wednesday, December 13, 2006

Issue of CRLF chars

I faced a very weird problem while I was trying to find log, check out or update files from the CVS repository. The following error message was flashed on the screen:
[myuserid@localhost java]$ cvs log .
myuserid@mycvshost's password:
cvs-1.11.17_p2 log: Logging .
: No such file or directoryopen directory /cvsroot/my/repository
cvs-1.11.17_p2 log: skipping directory
myuserid@mycvshost's password:
" but pserver says "/cvsroot/my/repository"/my/repository

I could sense that this might be related to some CRLF (Carriage Return-Line Feed) issue, as all the error lines seem to be starting with what look like end of string delimiters (":" or "\""). So to further clarify my doubt I redirected the output to a file and this is the exact error message I was getting:

cvs-1.11.17_p2 log: Logging .
cvs-1.11.17_p2 log: cannot open directory /cvsroot/my/repository^M: No such file or directory
cvs-1.11.17_p2 log: skipping directory
Protocol error: Root says "/cvsroot/my/repository^M" but pserver says "/cvsroot/my/repository"

Gotcha! You see those "^M" chars? I figured what was the problem. I had checked out all the files in my Win XP workstation, and FTPed the entire tree to my Linux box. That caused the whole issue!

To rectify that, do a dos2unix on all the files under each of the CVS directories. A simple script to do this task is given below:
for dir in `find . -name CVS -type d` ; do
dos2unix $dir/*
done

Remember: We are not doing a dos2unix on all the source files in those directories, rather we do dos2unix only on the CVS related files. Keep this in mind.

Tuesday, December 12, 2006

Java Platform Performance

I came across Java Platform Performance book while I was searching for something else. Thought this would be an interesting reading.

Thursday, December 07, 2006

Empty VMWare SCSI disks

We had a heated discussion in our team today. One of my teammates was complaining that the existing 8 GB disk (the .vmdk file) that he had attached to his VMWare Player was running out of space. Hence he needed a work around for that. Remember that all of us only have a VMWare Player, not a VMWare Workstation using which you can create a hard disk image. I suggested him a hack.
  • Copy the existing .vmdk file. Give it a new name.
  • Add that file as the next SCSI drive in your VWWare configuration file (.vmx file). You can do it easily by editing your .vmx file in notepad.
  • Start your virtual OS. In his case it was RH Linux.
  • Format the newly added disk. (mke2fs /dev/sdb).
You are done. You have another 8 GB of storage. But still I was not happy about this hack. What in case he exhausts all this 8 GB soon. So I was searching the Internet. My objective is simple: I have an up and running VMWare virtual OS where I would like to add a new SCSI drive of whatever size I want.

Well! Forever For Now gives empty SCSI disks for your VMWare player in three different sizes. Added to that, you also get a bunch of good tips-and-tricks that are very useful. Go ahead and give it a try!

Forever For Now site also gives a lot of other articles that are useful too. You might find it an interesting reading to go through their web site.