J2V8: Difference between revisions
Jump to navigation
Jump to search
Line 42: | Line 42: | ||
* [https://github.com/eclipsesource/j2v8 Building J2V8] | * [https://github.com/eclipsesource/j2v8 Building J2V8] | ||
* [https://github.com/alicorn-systems/v8-adapter V8 Adapter] | * [https://github.com/alicorn-systems/v8-adapter V8 Adapter] | ||
* [https://www.programcreek.com/java-api-examples/?api=com.eclipsesource.v8.V8Object V8Object] |
Revision as of 17:45, 28 February 2021
package com.example;
import com.eclipsesource.v8.V8;
public class EclipseCon_snippet5 {
public static class Printer {
public void print(String string) {
System.out.println(string);
}
}
public static void main(String[] args) {
V8 v8 = V8.createV8Runtime();
v8.registerJavaMethod(new Printer(), "print", "print", new Class<?>[]{String.class});
v8.executeVoidScript( "print('Hello, World!');" );
v8.release(true);
}
}
<dependencies>
<dependency>
<groupId>com.eclipsesource.j2v8</groupId>
<artifactId>j2v8_macosx_x86_64</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>