views:

329

answers:

2

When I insert a DVD or CD, I want to programmatically know what type of media(DVD or CD) is it.

A: 

[community remark here]

Looks like a code-challenge here.

Anyone with a Java class and a main function doing precisely what ThorDivDev is asking for ?

VonC
+2  A: 

IMHO impossible to get this solved with pure Java. The only thing you can do is via the FileSystemView and detect whether a certain file is a cd/dvd drive but not if it contains a CD or DVD as media. Although a one can perform an educated guess by getting the total used space.

For a working solution you'll need at least JNI code for the three "big" OS. I'm not aware of any project that has done this. There are only platform specific libraries / utilities for Linux that use the usual cdrw/dvdrw tools in the background.

Elmar Weber
...or at least suitable command line utilities to invoke and parse output from
JesperE