I think this is only possible if you have a virtual audio CD (built-in sound card driver with the โWhat you hearโ function, Virtual Audio Cable , virtual audio streaming or the like). After that, you just find a mixer that matches the virtual audiovisual device and create a TargetDataLine.
You can do this by changing the following code example:
Mixer.Info[] mixersInfo = AudioSystem.getMixerInfo();
//select virtual audiodevice by vendor name, device name or version
Mixer.Info selectedMixerInfo = mixersInfo[0];
TargetDataLine recordLine = AudioSystem.getTargetDataLine(aAudioFormat, selectedMixerInfo);