java-How to print current JVM classpath without write any code
1. The purpose of this post
I would demo how to print current JVM classpath without write any code.
2. Environments
- java 1.6+
3. How to print current JVM classpath without write any code
3.1 The old way: Use System.getProperty() to get it
The old way to print the JVM current classpath at runtime is write the following code:
3.2 The new way: use arthas
arthas is a free java diagnostic tool provided by alibaba, and it’s dedicated for troubleshooting production issues for Java applications without modifying code or restarting servers.
3.2.1 Download and install arthas
You would get this:
3.2.2 Start your application and find the PID of it
Now exit arthas by input this command:
Now start your java application and reference this article to find and determine the PID of your java application.
3.2.3 Use arthas to show your classpath at runtime
Start arthas by input:
choose the PID of your java process and then input this command:
Then you would get this result:
You can see that you can print the classpath without writing any code or restarting your application.
- springboot interview Q&A series 1
- springboot interview Q&A series 2
- springboot interview Q&A series 3
- springboot interview Q&A series 4