IMHO it is impossible to solve this problem with pure Java. The only thing you can do is through FileSystemView and determine if a particular file is a cd / dvd but does not contain a CD or DVD. Although you can get a reasonable assumption by getting the total used space.
For a working solution, you will need at least JNI code for the three "large" OS. I do not know any project that has done this. For Linux, there are only platform-specific libraries / utilities that use the usual cdrw / dvdrw tools in the background.
source share