Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

faq about Java8 java.lang.invoke.LambdaForm

Trying to shrink the size of jre for a java swing program. Using the following command to print all the loaded class:

java -jar -verbose:class demo.jar >>class.txt

In the result,i see something which i donot know where it is.I am using jre8 and following is:

[Loaded java.lang.invoke.LambdaForm$DMH/603742814 from java.lang.invoke.LambdaForm]
[Loaded java.lang.invoke.LambdaForm$LFI/1067040082 from java.lang.invoke.LambdaForm]
[Loaded java.lang.invoke.LambdaForm$LFI/1325547227 from java.lang.invoke.LambdaForm]
[Loaded java.lang.invoke.LambdaForm$NFI/980546781 from java.lang.invoke.LambdaForm]

what does java.lang.invoke.LambdaForm$NFI and java.lang.invoke.LambdaForm$DMH and java.lang.invoke.LambdaForm$LFI stands for? I check the classes in rt.jar.It does not have these class or innerclass. Any idea? thanks!

like image 226
snow8261 Avatar asked Jul 24 '26 04:07

snow8261


1 Answers

As documented here, these nested classes are used in the representation of lambda forms, which are used in the implementation and optimization of method handles (no relation to lambda expressions.) If you want to shrink the size of the deployed JRE for a Java Swing program, use Compact Profiles, which "enable reduced memory footprint for applications that do not require the entire Java platform."

Addendum: As shown here, Swing is available only with the full API.

like image 157
trashgod Avatar answered Jul 25 '26 18:07

trashgod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!