You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Compatibility with JSR-223 ScriptEngine](#compatibility-with-jsr-223-scriptengine)
27
27
28
-
The GraalVM Polyglot API lets you embed and run code from guest languages in JVM-based host applications.
28
+
The [GraalVM Polyglot API](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/package-summary.html) lets you embed and run code from guest languages in Java host applications.
29
29
30
-
Throughout this section, you will learn how to create a host application in Java that runs on GraalVM and directly calls a guest language.
30
+
Throughout this section, you will learn how to create a host application in Java that runs on GraalVM and directly calls a guest language.
31
31
You can use the tabs beneath each code example to choose between JavaScript, R, Ruby, and Python.
32
32
33
-
> Note: The usage description for polyglot embeddings was revised with the GraalVM for JDK 22 (24.0.0) release. If you are still using a GraalVM version older than 23.1.x, ensure the correct version of the documentation is displayed. More information on the change can be found in the [release notes](https://www.graalvm.org/release-notes/JDK_21/#graalvm-for-jdk-21).
33
+
> Note: The usage description for polyglot embeddings was revised with GraalVM for JDK 21 and Polyglot API version 23.1.0. If you are still using Polyglot API version older than 23.1.0, ensure the correct version of the documentation is displayed. More information on the change can be found in the [release notes](https://www.graalvm.org/release-notes/JDK_21/#graalvm-for-jdk-21).
34
34
35
35
## Dependency Setup
36
36
37
-
Since GraalVM Polyglot API version 23.1.0, all necessary artifacts can be downloaded directly from Maven Central.
38
-
All artifacts relevant to embedders can be found in the Maven dependency group [`org.graalvm.polyglot`](https://central.sonatype.com/namespace/org.graalvm.polyglot).
37
+
Since Polyglot API version 23.1.0, all necessary artifacts can be downloaded directly from Maven Central.
38
+
Artifacts relevant to embedders can be found in the Maven dependency group [`org.graalvm.polyglot`](https://central.sonatype.com/namespace/org.graalvm.polyglot).
39
39
See the [polyglot embedding demonstration](https://github.com/graalvm/polyglot-embedding-demo) on GitHub for a complete runnable example.
40
40
41
41
Here is an example Maven dependency setup that you can put into your project:
<!-- Select a tool: profiler, inspect, coverage, dap, tools -->
59
+
<artifactId>profiler</artifactId>
61
60
<version>${graalvm.polyglot.version}</version>
62
61
<type>pom</type>
63
62
</dependency>
64
-
<!-- add specific tools if needed -->
65
63
```
66
64
65
+
> The `pom` type is a requirement for language or tool dependencies.
66
+
67
67
Language and tool dependencies use the [GraalVM Free Terms and Conditions (GFTC)](https://www.oracle.com/downloads/licenses/graal-free-license.html) license.
68
68
To use community-licensed versions instead, add the `-community` suffix to each artifact (for example, `js-community`).
69
69
To access [polyglot isolate](#polyglot-isolates) artifacts, use the `-isolate` suffix instead (for example, `js-isolate`).
70
70
71
-
The artifacts `polyglot` and `tools` include all available languages and tools as dependencies.
71
+
The artifacts `languages` and `tools` include all available languages and tools as dependencies.
72
72
This artifact might grow or shrink between major releases. We recommend selecting only the needed language(s) for a production deployment.
73
73
74
-
> The `pom` type is a requirement for language or tool dependencies.
75
-
76
-
Additionally, your _module-info.java_ file should require `org.graalvm.polyglot` when using Java modules.
77
-
74
+
Additionally, your _module-info.java_ file should require `org.graalvm.polyglot` when using Java modules:
78
75
```java
79
76
module com.mycompany.app {
80
77
requires org.graalvm.polyglot;
@@ -89,14 +86,14 @@ Be aware that using `org.graalvm.polyglot` from the class path instead will enab
89
86
If the application is not yet modularized, hybrid use of the class path and module path is possible.
In this example, `lib/polyglot` directory should contain all polyglot and language JAR files.
95
92
To access polyglot classes from the class path, you must also specify the `--add-modules=org.graalvm.polyglot` JVM option.
96
-
If you are using [native-image](https://www.graalvm.org/latest/reference-manual/embed-languages/#build-native-executables-from-polyglot-applications), polyglot modules on the class path will be automatically upgraded to the module path.
93
+
If you are using [GraalVM Native Image](#build-native-executables-from-polyglot-applications), polyglot modules on the class path will be automatically upgraded to the module path.
97
94
98
-
While we do support creating single uber JAR files from polyglot libraries, for example using the Maven Assembly plugin, we do not recommend it.
99
-
Also note that uber JAR files are not supported in combination with creating native-images.
95
+
While we do support creating single uber JAR files from polyglot libraries, for example, using the Maven Assembly plugin, but we do not recommend it.
96
+
Also note that uber JAR files are not supported when creating native binaries with GraalVM Native Image.
100
97
101
98
## Compile and Run a Polyglot Application
102
99
@@ -116,12 +113,12 @@ Complete the steps in this section to create a sample polyglot application that
116
113
117
114
4. Update the Maven [pom.xml](https://github.com/graalvm/polyglot-embedding-demo/blob/main/pom.xml) dependency configuration to include the languages to run as described in the [previous section](#dependency-setup).
118
115
119
-
5. [Download and setup GraalVM](../../getting-started/get-started.md) by setting the value of the `JAVA_HOME` environment variable to the location of a GraalVM JDK.
116
+
5. [Download and install GraalVM](../../getting-started/get-started.md) by setting the value of the `JAVA_HOME` environment variable to the location of a GraalVM JDK.
120
117
121
118
6. Run `mvn package exec:exec` to build and execute the sample code.
122
119
123
120
You now have a polyglot application that consists of a Java host application and guest language code, running on GraalVM.
124
-
You can use this application with other code examples to demonstrate more advanced capabilities of the Polyglot API.
121
+
You can use this application with other code examples to demonstrate more advanced capabilities of the GraalVM Polyglot API.
GraalVM provides runtimes for JavaScript, Ruby, Python, and a number of other popular languages.
11
11
GraalVM's polyglot capabilities make it possible to mix multiple programming languages in a single application while eliminating any foreign language call costs.
12
12
13
-
If you are mostly interested in GraalVM's support for a specific language, here you can find the most extensive documentation:
14
-
13
+
If you are mostly interested in a specific language runtime on GraalVM, see the following:
15
14
*[Java on Truffle](java-on-truffle/README.md)
16
-
*[JavaScript and Node.js](https://github.com/oracle/graaljs/blob/master/docs/user/README.md)
Copy file name to clipboardExpand all lines: docs/reference-manual/reference-manuals.md
+12-19Lines changed: 12 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,28 +6,21 @@ permalink: /reference-manual/
6
6
redirect_from: /docs/reference-manual/
7
7
---
8
8
9
-
# GraalVM Reference Manuals
9
+
# Reference Manuals
10
10
11
11
Here you will find the in-depth documentation for technologies offered by GraalVM.
12
12
These manuals are aimed at software engineers and developers who already work with GraalVM, or are considering it as an environment for their workloads.
13
13
14
-
## Technologies
14
+
* Learn more about [GraalVM as a Java Virtual Machine](java/README.md) and its optimizing just-in-time compiler, [Graal Compiler](java/compiler.md).
15
+
* Developers interested in embedding other languages into Java, proceed to [Embedding Languages](embedding/embed-languages.md).
16
+
* Developers interested in building interpreters for programming languages which then run on GraalVM, continue to the [Truffle language implementation framework documentation](../../truffle/docs/README.md).
17
+
* To learn more about security considerations in GraalVM, check the [Security Guide](security/security-guide.md).
15
18
16
-
[Native Image](native-image/README.md) - learn in detail about Native Image: GraalVM's innovative technology that can ahead-of-time compile Java code to a self-contained native executable.
17
-
18
-
[Java on Truffle](java-on-truffle/README.md) - learn how to run Java via a Java bytecode interpreter, implemented with the [Truffle framework](../../truffle/docs/README.md).
19
-
20
-
[Polyglot Programming](polyglot-programming.md) - learn how to write polyglot applications and allow languages to directly interoperate with each other in the same memory space.
21
-
22
-
[Embedding Languages](embedding/embed-languages.md) - learn how to embed polyglot applications in Java host applications or native images.
23
-
24
-
## Specific Languages
25
-
26
-
If you are mostly interested in the GraalVM support for a specific language, here you can find the most extensive documentation:
27
-
28
-
*[JavaScript and Node.js](js/README.md)
19
+
If you are mostly interested in a specific language runtime on GraalVM, see the following:
0 commit comments