How to get source dependencies from javac?
<p>I have three source files: <code>X.java</code>, <code>A.java</code>, <code>B.java</code>. The class <code>X</code> uses the classes <code>A</code> and <code>B</code>. When I compile <code>X</code> with</p>

<pre><code>$ javac X.java
</code></pre>

<p>I get tree class files: <code>X.class</code>, <code>A.class</code>, <code>B.class</code>. <code>javac</code> analyzes the source of <code>X.java</code> and finds out that the classes <code>A</code> and <code>B</code> are used and compiles the matching source files automatically.</p>

<p>How can I tell <code>javac</code> to dump the dependencies without compiling the code?</p>

<p>I found <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4162387" rel="nofollow">a hint in the web</a> about a <code>-xdepend</code> option but this <a href="http://mail-archives.apache.org/mod_mbox/ant-user/200201.mbox/%3COFF8107B69.ACEB3A1A-ON86256B37.00119A60@trilogy.com%3E" rel="nofollow">seems to be removed</a> from javac since 1.3.1. What is the preferred way to do this nowadays?</p>

<p>I am using:</p>

<pre><code>$ java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)
</code></pre>
