You are on page 1of 1

Quick Reference

Run Java Applications Enable Polyglot Programming


Java application
Compile a Java class: Run a ode s applica ion:
N .j t

javac MyApp.java node myApp.js


Run he applica ion from a JAR le:
t t fi
Java Build Tool
Run a Java crip R Rub
S t, , y, Pyt hon , LLVM applica ion:
t

java -jar MyApp.jar js myApp.js


mvn package / gradle build
S pecif he class pa h for he app:
y t t t
graalpython myApp.py
java -cp target/myapp.jar ruby myApp.rb
com.mycompany.app.MyApp R myApp.r
Native Image Builder
Run he J compiler as JAR or na ive librar defaul :
t IT t y ( t)
lli myApp
native-image -jar App.jar
-XX:±UseJVMCINativeLibrary Run o her languages in a Java applica ion:
t t

elec he raal compiler con gura ion:


S t t G VM fi t
org.graalvm.polyglot
-Dgraal.CompilerConfiguration= JIT AOT .Context
enterprise|community|economy
java -jar App.jar ./app .createContext()
P rin he de ails for he J compiled code:
t t t t IT
.eval("languageId", "code");
-Dgraal.PrintCompilation=true
P roduce he diagnos ic da a for he compila ion:
t t t t t
B uild a shared librar : y E nable pol glo capabili ies for an applica ion:
y t t t

-Dgraal.Dump --shared --polyglot --jvm


L oad a avaagen :j t
B uild a s a icall linked na ive image:
t t y t Limi resources for he applica ion:
t t t

-javaagent:<jarpath>[=<options>] --static --libc=glibc|musl --sandbox.MaxCPU ime=<ms> T

-agentlib:<libname>[=<options>] nclude a language run ime in he na ive image:


I t t t
--sandbox.Max tatements=N S

--language:js|python|ruby|llvm|wasm D ebug he applica ion:


t t

C ompile to ative E ecutables N x U se pro le guided op imi a ions:


fi - t z t
--inspect[=[host:]<port number>]
native-image --pgo-instrument MyApp --inspect-br k
ns all he na ive image builder from a local le:
./myapp and appl load
I t t t fi
ro le he applica ion:
gu install -L native-image.jar # y P fi t t

native-image --pgo profile.iprof MyApp --cpusampler


N a ive mage command s n a :
t I y t x
--cputracer
Attach a debugger:
native-image [options] MyClass --memtracer
--debug-attach=[port]
B uild a na ive image of a JAR le:
t fi
race classes ini iali a ion:
native-image -jar MyApp.jar
T t z t

--trace-class-initialization
Run a na ive image:
is all image build op ions for e per s:
t

./myapp
L t t x t

--expert-options-all

https//: www.graalvm.org ver: 1.000

You might also like