public class JkNativeCompilation
extends java.lang.Object
This class enables users to generate a native executable by providing:
The process of generating a native executable involves several steps:
nativeImage
program.nativeImage
program to compile
the JAR files into a native executable.Users can configure the native compilation process via the following options:
libc
library.
Levels: NONE
, MOSTLY
, and MUSL
.The GraalVM distribution used for native compilation is selected based on the following precedence:
JEKA_GRAALVM_HOME
environment variable is defined, its value is used as the GraalVM path.DOWNLOAD_
(e.g., DOWNLOAD_21
),
GraalVM is downloaded from the internet if it is not already present in the local Jeka cache.
After configuring the input JARs and compilation options, use the make
method
to start the compilation process. The resulting executable will be produced in the output path.
Modifier and Type | Class and Description |
---|---|
class |
JkNativeCompilation.ReachabilityMetadata |
static class |
JkNativeCompilation.StaticLink |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_GRAALVM_VERSION |
static java.lang.String |
DEFAULT_REPO_VERSION |
JkNativeCompilation.ReachabilityMetadata |
reachabilityMetadata |
Modifier and Type | Method and Description |
---|---|
JkNativeCompilation |
addExtraParams(java.lang.String... params) |
java.util.List<java.nio.file.Path> |
getAotMetadataRepoPaths() |
java.util.List<java.nio.file.Path> |
getClasspath() |
java.util.List<java.lang.String> |
getNativeImageParams(java.lang.String outputFile,
java.lang.String classpathAsString) |
JkNativeCompilation.StaticLink |
getStaticLinkage() |
void |
make(java.nio.file.Path outputFile)
Generates a native image at the specified file location.
|
static JkNativeCompilation |
ofClasspath(java.util.List<java.nio.file.Path> classpath) |
JkNativeCompilation |
setIncludesAllResources(boolean includesAllResources) |
JkNativeCompilation |
setMainClass(java.lang.String mainClass) |
JkNativeCompilation |
setStaticLinkage(JkNativeCompilation.StaticLink staticLink) |
public static final java.lang.String DEFAULT_GRAALVM_VERSION
public static final java.lang.String DEFAULT_REPO_VERSION
public final JkNativeCompilation.ReachabilityMetadata reachabilityMetadata
public static JkNativeCompilation ofClasspath(java.util.List<java.nio.file.Path> classpath)
public JkNativeCompilation setStaticLinkage(JkNativeCompilation.StaticLink staticLink)
public JkNativeCompilation addExtraParams(java.lang.String... params)
public JkNativeCompilation setMainClass(java.lang.String mainClass)
public JkNativeCompilation setIncludesAllResources(boolean includesAllResources)
public java.util.List<java.nio.file.Path> getClasspath()
public JkNativeCompilation.StaticLink getStaticLinkage()
public java.util.List<java.nio.file.Path> getAotMetadataRepoPaths()
public void make(java.nio.file.Path outputFile)
public java.util.List<java.lang.String> getNativeImageParams(java.lang.String outputFile, java.lang.String classpathAsString)