title: Hijack audio with Java?
body: <p>I have been trying to modify some code found <a href="http://www.java-tips.org/java-se-tips/javax.sound/capturing-audio-with-java-sound-api.html" rel="nofollow">at the bottom of this page</a> in order to hijack system audio with Java. Here's the part that I modified in captureAudio():</p>
  
  <pre><code>Mixer mixer = AudioSystem.getMixer(mixerInfo[0]); // "Java Sound Audio Engine"
  final TargetDataLine line = (TargetDataLine) mixer.getLine(info);
  </code></pre>
  
  <p>Now when I run this code, it throws this:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian
  </code></pre>
  
  <p>I have tried changing my format to fit with the required format, but the exception doesn't go and nothing is recorded. What am I doing wrong?</p>