Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.94 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to print imported java libraries?
  2. import javax.swing.JFrame;
  3. public class Main {
  4.  
  5.     /**
  6.      * @param args the command line arguments
  7.      */
  8.     public static void main(String[] args) {
  9.         //some code
  10.     }  
  11. }
  12.        
  13. import com.thoughtworks.qdox.JavaDocBuilder;
  14. import javax.swing.JFrame;
  15. public class Main {
  16.  
  17.     /**
  18.      * @param args the command line arguments
  19.      */
  20.     public static void main(String[] args) {
  21.         JavaDocBuilder java = new JavaDocBuilder();
  22.         java.addSourceTree(new java.io.File("."));
  23.         for (String i : java.getClassByName("Main").getSource().getImports()) {
  24.             System.out.println(i);
  25.         }
  26.     }
  27. }
  28.        
  29. # If you don't have wget, just download the QDox jar by hand
  30. wget -U "" http://repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.jar
  31.  
  32. javac -classpath qdox-1.12.jar Main.java
  33. java -classpath qdox-1.12.jar:. Main
  34.        
  35. com.thoughtworks.qdox.JavaDocBuilder
  36. javax.swing.JFrame