Use loosejar to clear redundant jar packages in applications

Source: Internet
Author: User

As the application scale increases, the number of jar packages that are dependent on is also greatly increased, many of which are redundant and cannot be used. Jar package occupies a large amount of valuable space. With the loosejar tool, you can easily find Jar package ~
Loosejar uses classloader. Which of the following is used when the application is running? Class, classloader will load the. Class file of this class into JVM, and then generate a class pair And then use reflection to execute the class method, so which. class files are loaded Classloader is clear. With this feature, you can know the actual usage of classes in the jar package. And the actual usage of the jar package in the application.
Step 1: Put loosejar. jar in the Lib under the application's WEB-INF, for example, the path is
D:/workspaces/appnotify/webroot/WEB-INF/lib/loosejar. Jar

Step 2: Configure-dfile. Encoding = uft8 in JDK of installedjres in IDE
-Javaagent: D:/workspaces/appnotify/webroot/WEB-INF/lib/loosejar. Jar

Step 3: start the application and test your application with full path coverage as much as possible.
Line.

Step 4: In the JDK installation path, select the port of Bootstrap in the jconsole in the bin folder.
Select com. googlecode. loosejar under mbean and click summary to view the analysis result ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.