jarbloat

Analyze java jar files

OTHER License

Stars
0

jarbloat

A simple tool to analyze the content and size of a Java JAR file. Inspired with go-size-analyzer.

Features:

  • Works on Java >= 8
  • Detail size breakdown by files and packages
  • Support multiple output formats: table (can be used in markdown or
    org-mode files), json, csv and interactive html
  • Support for analyzing the dependency of each class file (within a jar) and
    displaying dependency graph in Graphviz dot format
  • It can be compiled with GraalVM for fast startup

Usage

Download the latest release from releases page. You can run OS independent jarbloat.jar with:

java -jar jarbloat.jar [options] <app.jar>

or you can run OS dependant binary with:

# linux
jarbloat-linux-amd64 [options] <app.jar>

# macos
jarbloat-darwin-amd64 [options] <app.jar>

# windows
jarbloat-windows-amd64.exe [options] <app.jar>

Compilation

To compile jarbloat, make sure you have leiningen installed and make. Run:

make uberjar

and you will get a standalone uberjar in target/jarbloat.jar. To compile it to a standalone binary, install GraalVM and run:

make native NATIVE_IMAGE=<path/to/native-image>

Github Actions will automatically create OS dependent binaries for every new release.

License

Copyright © 2024 Sanel Zukan

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.