Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User guide to decrease the output of executable #2619

Closed
strogiyotec opened this issue Jun 27, 2020 · 1 comment
Closed

User guide to decrease the output of executable #2619

strogiyotec opened this issue Jun 27, 2020 · 1 comment
Assignees

Comments

@strogiyotec
Copy link

Good day, I'm working on small CLI app and I want to build native image from it. The app itself is not complicated , the only dependency it has is Jline3. You can check my pom file here. The problem is that the final size of executable is 15MB which is too big for me, I already found this ticket which has similar problem(I use java 11 and I don't think that footprint comes from javafx). What I want is the user guide on how to trouble shoot such problems and fix them. Maybe I can explicitly remove gc and specify some parameters as buildArgs for maven plugin. I didn't find anything related to it in official documentation. My final goal is to decrease the size to 3Mb because I already have the same program written in GoLang and I want to prove that Java version could have the same size. Thank you
This is my graal info

gu list
ComponentId              Version             Component name      Origin
--------------------------------------------------------------------------------
graalvm                  20.0.0              GraalVM Core
native-image             20.0.0              Native Image        github.com

And java

java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
@wirthi
Copy link
Member

wirthi commented Nov 6, 2024

Our documentation on this can be found at https://www.graalvm.org/jdk23/reference-manual/native-image/guides/optimize-for-file-size/

There now is the -Os flag to optimize for size. 3MB seems a bit ambitious but it should bring you lower than what you had before.

@wirthi wirthi closed this as completed Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants