GraalVM: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(27 intermediate revisions by the same user not shown)
Line 2: Line 2:
| valign="top" |
| valign="top" |
<source lang="bash">
<source lang="bash">
# export GRAALVM_HOME=/d/opt/cli/mandrel-java11-21.2.0.0-Final
export GRAALVM_HOME=/d/opt/cli/mandrel-java11-21.2.0.0-Final
export PATH=$GRAALVM_HOME/bin:$PATH
</source>
'''OR'''
<source lang="bash">
export GRAALVM_HOME=/d/opt/cli/graalvm-ce-java11-21.2.0
export GRAALVM_HOME=/d/opt/cli/graalvm-ce-java11-21.2.0
export PATH=$GRAALVM_HOME/bin:$PATH
export PATH=$GRAALVM_HOME/bin:$PATH
gu install native-image
</source>
</source>


| valign="top" |
| valign="top" |
<source lang="bat">
<source lang="bat">
@rem set GRAALVM_HOME=D:\opt\cli\mandrel-java11-21.2.0.0-Final
set GRAALVM_HOME=D:\opt\cli\mandrel-java11-21.2.0.0-Final
set PATH=%GRAALVM_HOME%/bin;%PATH%
</source>
'''OR'''
<source lang="bat">
set GRAALVM_HOME=D:\opt\cli\graalvm-ce-java11-21.2.0
set GRAALVM_HOME=D:\opt\cli\graalvm-ce-java11-21.2.0
set PATH=%GRAALVM_HOME%/bin;%PATH%
set PATH=%GRAALVM_HOME%/bin;%PATH%
gu install native-image
</source>
</source>
|}


|-
| valign="top"|
<source lang="bash">
<source lang="bash">
# for oracle linux, debian, redhat
# for oracle linux, debian, redhat
Line 20: Line 31:
sudo apt install build-essential libz-dev zlib1g-dev
sudo apt install build-essential libz-dev zlib1g-dev
sudo dnf install gcc glibc-devel zlib-devel libstdc++-static
sudo dnf install gcc glibc-devel zlib-devel libstdc++-static
</source>


| valign="top"|
<source lang="bash">
# to use xcode in macos
# to use xcode in macos
xcode-select --install
xcode-select --install
# to use glibc in alpine
apk add --no-cache libc6-compat
</source>
</source>
|}


==Build a Shared Library==
==Build a Shared Library==
Line 37: Line 54:
| valign="top" |
| valign="top" |
* [https://www.graalvm.org/uploads/graalvm-language-level-virtualization-oracle-tech-papers.pdf GraalVM Language Level Virtualization]
* [https://www.graalvm.org/uploads/graalvm-language-level-virtualization-oracle-tech-papers.pdf GraalVM Language Level Virtualization]
* [https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/ GraalVM Spring Native Documentation]
* [https://www.graalvm.org/reference-manual/polyglot-programming/ GraalVM Polyglot Programming]
* [https://www.graalvm.org/reference-manual/polyglot-programming/ GraalVM Polyglot Programming]
* [https://github.com/graalvm/graalvm-ce-builds/releases GraalVM Community Edition]
* [https://github.com/graalvm/graalvm-ce-builds/releases GraalVM Community Edition]
Line 45: Line 63:
* [[Quarkus]]
* [[Quarkus]]
* [[Docker]]
* [[Docker]]
| valign="top" |
* [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://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://developer.okta.com/blog/2019/11/27/graalvm-java-binaries GraalVM Mix JavaScript and Java]
* [https://medium.com/graalvm/3-ways-to-polyglot-with-graalvm-fb28c1542b45 GraalVM Polyglot Programming]
* [[Debian/GraalVM]]
* [[Fedora/GraalVM]]
* [[Ubuntu/GraalVM]]
* [[MacOS/GraalVM]]
| valign="top" |
* [https://blogs.oracle.com/developers/post/building-cross-platform-native-images-with-graalvm GraalVM: Build a Cross Platform Native Images]
* [https://blog.softwaremill.com/small-fast-docker-images-using-graalvms-native-image-99c0bc92e70b Small & fast Docker images using GraalVM]
* [https://www.batey.info/graalvm-docker-small-images.html Tiny docker images for Java with GraalVM]
* [https://codetinkering.com/install-graalvm-native-image-mac/ Install GraalVM & Native-Image on a Mac]
* [https://www.graalvm.org/22.0/reference-manual/js/ GraalVM: JavaScript Implementation]
* [https://www.graalvm.org/22.0/reference-manual/js/JavaScriptCompatibility/ GraalVM: JavaScript Compatibility]
* [https://zeringue.io/post/graalvm-gradle-docker/ Build Slim Java Native Container]
* [https://medium.com/@john_freeman/native-javac-with-graalvm-ddcc18a53edb Native javac built with GraalVM]
* [https://www.graalvm.org/docs/getting-started/macos/ GraalVM on macOS Platforms]
* [https://github.com/graalvm/mandrel/releases Mandrel: Download]
|-
| colspan="3" |
----
|-
| valign="top" |
* [https://www.graalvm.org/22.0/reference-manual/native-image/StaticImages/ GraalVM » Static & Mostly Static Images]
| valign="top" |
| valign="top" |
|-
| colspan="3" |
----
'''Getting Started:'''
----
|-
| valign="top" |
* [https://www.graalvm.org/22.0/docs/getting-started/ Get Started with » GraalVM » 22.0]
| valign="top" |
* [https://www.graalvm.org/22.0/docs/getting-started/linux/  Get Started with » GraalVM » 22.0 » Linux]
| valign="top" |
* [https://www.graalvm.org/22.0/docs/getting-started/container-images/ Get Started with » GraalVM » 22.0 » Docker]
|-
| colspan="3" |
----
|-
| valign="top" |
* [[SDKMan]]
| valign="top" |


| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 21:46, 3 March 2024

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
# to use glibc in alpine
apk add --no-cache libc6-compat

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



Getting Started: