Use loosejar to clear redundant jar packages in the application.

Source: Internet
Author: User

Use loosejar to clear redundant jar packages in the application.
As the application grows, the number of dependent jar packages has also increased significantly, and many of them are redundant. jar packages that cannot be used occupy a large amount of valuable space. With the loosejar tool, you can easily find the jar package of "Garbage Collection ~
Loosejar uses classloader. Because the classloader specifies the class used when the application is running. the class file is loaded into the jvm, and a class object is generated. Then, reflection can be used to execute the class method. the class file is loaded, and the 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 ~
How can I delete a redundant jar package in a java project developed in myeclipse when it encounters jar package redundancy? There are more than one hundred jar packages in a large project

For Java, you generally have your own jar package. Create a project, add the framework, manually delete all the jar packages in lib, and then import your jar packages, this will not cause redundancy, and some jar packages are shared by multiple frameworks. When MyEclipse is automatically added, version inconsistency may occur, leading to the failure of compilation of the entire project. Look for a Java guru and ask them for the jar package you need.

There are too many JAR packages under lib in the project. How can we clean up useless JAR packages?

In the left-side package explorer box, there is a triangle icon in the upper right corner. Click it and select filter from the drop-down menu. Then, in the new window, select the first multiple choice box: name filter mode, enter * in the text box *. jar file.
If you want to delete useless jar packages, right-click your project, select the java build path (java builting) in the pop-up attribute box, and delete useless jar packages in the library tab.
:)

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.