Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 1.52 KB

specify-class-initialization.md

File metadata and controls

30 lines (23 loc) · 1.52 KB
layout toc_group link_title permalink
ni-docs
how-to-guides
Specify Class Initialization
/reference-manual/native-image/guides/specify-class-initialization/

Specify Class Initialization Explicitly

Two command line flags explicitly specify when a class should be initialized: --initialize-at-build-time and --initialize-at-run-time. You can use the flags to specify whole packages or individual classes. For example, if you have the classes p.C1, p.C2, … ,p.Cn, you can specify that all the classes in the package p are initialized at build time by passing the following argument to native-image on the command line:

--initialize-at-build-time=p

If you want only one of the classes in package p to be initialized at runtime, use:

--initialize-at-run-time=p.C1

The whole class hierarchy can be initialized at build time by passing --initialize-at-build-time on the command line.

Class initialization can also be specified programmatically using RuntimeClassInitialization from the Native Image feature.

Related Documentation