- Use the '-verbose:class' argument with the 'java' command when starting the program.
- Use 'System.getProperty("java.class.path");' inside the program to print the classpath.
But both these issues have constraints, thus have a limited usability when it comes to third party application. But the following solution will be more elegant and it can be used while running the java application which might have been developed by us or some other party.
- First locate the process ID of the Java application. If you are on Linux this can be easily done using the system monitor or you can select the hard way, the terminal ;-)
- Once you have identified PID, execute the command, 'lsof -p <PID>' (If you have a large number of dependent libraries, you can take the output of this command into a file by executing 'lsof -p <PID> > <path/to/file>' )
- This will generate the list of open files of that process. This contains the list of JARs, the program keeps in its classpath.