Skip to content

Commit 5b5cc93

Browse files
committed
Java Interoperability documentation fixes.
1 parent 0b06979 commit 5b5cc93

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

docs/user/NodeJSVSJavaScriptContext.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,9 @@ In this scenario, Java classes can be exposed to the Node.js application by usin
3131
## Java Interoperability
3232

3333
JavaScript applications can interact with Java classes using the `Java` built-in object.
34-
The object is not available by default, and can be enabled in the following way:
34+
This object is available by default in the `js` and `node` launchers, but accessing Java classes is only possible in the JVM standalones (that have `-jvm` in the name).
3535

36-
1. In Node.js mode, start GraalVM using the `bin/node --jvm` command.
37-
2. In Java, create a GraalVM context using the `withHostInterop()` option, e.g.:
38-
```java
39-
Context.create("js").withHostInterop()
40-
```
36+
When embedding GraalVM JavaScript using the Polyglot API, you have to explicitly enable host access in the [`Context.Builder`](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Context.Builder.html) (`allowHostAccess`, `allowHostClassLookup`).
4137
More details on the Java interoperability capabilities of GraalVM JavaScript are available in [Java Interoperability](JavaInteroperability.md).
4238

4339
## Multithreading
@@ -57,7 +53,7 @@ More details on parallel execution in GraalVM JavaScript are available in [this
5753
Java libraries can be accessed from JavaScript in GraalVM through the `Java` built-in object.
5854
In order for a Java library to be accessible from a `Context`, its `jar` files need to be added to the GraalVM classpath. This can be done in the following way:
5955

60-
1. In Node.js mode, the classpath can be modified using the `--jvm.cp` option.
56+
1. In Node.js mode, the classpath can be modified using the `--vm.cp` option.
6157
2. In Java, the default Java's `-cp` option can be used.
6258

6359
More details on GraalVM command line options are available in [Options](Options.md).

0 commit comments

Comments
 (0)