Java Sucks

Every time I try to do something cool in Java I am reminded again how much it sucks. For instance, you can now query for root paths on the filesystem which is operating system independant. On Windows you will get a list of drive letters. On UNIX you’ll just get /. On MacOS you’ll get a list of volumes and so on.

That works great. What doesn’t work great is if you want to see if you can read the drive letters returned by Windows. On my machine I get A:, C:, D:, and E:. I think, “Hey, it would be useful to be able to tell if there is a disk in drive A:” Unfortunatly there doesn’t seem to be a way to do that. If you do any kind of IO query on that drive and there is no disk in the drive you get a big system modal error box that there is no way to programmatically close. Your program freezes never to return. If you are writing a client program that’s not too bad, the user can just dismiss the dialog but if you are trying to write a daemon type program such as the one I am trying to write you are totally screwed.

So, if anyone knows how to query the A: drive (a floppy drive in my case) without locking the program if there’s no disk in the drive, please let me know.