Is there a way to print within a Java Code the libraries that has been imported, and available during the execution?
For example :
import javax.swing.JFrame;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//some code
}
}
I need to print javax.swing.JFrame.
If you need the actual imports used in your source code (rather than using the information in the bytecode), you can use a library called QDox which will parse your source code and can get a list of the imports you use:
Main.java
Compile and run with:
The output is: