GraalVM: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 62: Line 62:
* [https://www.graalvm.org/reference-manual/native-image/Reflection/ GraalVM Reflection Use in Native Images]
* [https://www.graalvm.org/reference-manual/native-image/Reflection/ GraalVM Reflection Use in Native Images]
* [https://dzone.com/articles/profiling-native-images-in-java GraalVM Profiling Native Images in Java]
* [https://dzone.com/articles/profiling-native-images-in-java GraalVM Profiling Native Images in Java]
* [https://www.graalvm.org/release-notes/version-roadmap/ GraalVM Community Version Roadmap]
* [https://www.infoq.com/news/2021/03/spring-native-beta-available/ Convert Spring Boot Apps to GraalVM]
* [https://www.infoq.com/news/2021/03/spring-native-beta-available/ Convert Spring Boot Apps to GraalVM]
* [https://developer.okta.com/blog/2019/11/27/graalvm-java-binaries GraalVM Mix JavaScript and Java]
* [https://developer.okta.com/blog/2019/11/27/graalvm-java-binaries GraalVM Mix JavaScript and Java]

Revision as of 10:46, 1 December 2021

export GRAALVM_HOME=/d/opt/cli/mandrel-java11-21.2.0.0-Final
export PATH=$GRAALVM_HOME/bin:$PATH

OR

export GRAALVM_HOME=/d/opt/cli/graalvm-ce-java11-21.2.0
export PATH=$GRAALVM_HOME/bin:$PATH
gu install native-image
set GRAALVM_HOME=D:\opt\cli\mandrel-java11-21.2.0.0-Final
set PATH=%GRAALVM_HOME%/bin;%PATH%

OR

set GRAALVM_HOME=D:\opt\cli\graalvm-ce-java11-21.2.0
set PATH=%GRAALVM_HOME%/bin;%PATH%
gu install native-image
# for oracle linux, debian, redhat
sudo yum install gcc glibc-devel zlib-devel
sudo apt install build-essential libz-dev zlib1g-dev
sudo dnf install gcc glibc-devel zlib-devel libstdc++-static

# to use xcode in macos
xcode-select --install

Build a Shared Library

To build a native image as a shared library of a Java class file, pass --shared to the native image builder. The created shared library will have the main method of the given Java class as its entrypoint method.

native-image class [libraryname] --shared

To build a native image as a shared library of a JAR file, use:

native-image -jar jarfile [libraryname] --shared

Note: if you build a shared library where you do not specify a main class, you must append the -H:Name= flag to specify the library name: -H:Name=libraryname.

References