J2V8: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 35: Line 35:


==References==
==References==
{|
| valign="top" |
* [http://eclipsesource.com/blogs/2015/06/06/registering-java-callbacks-with-j2v8/ Registering Java Callbacks with J2V8]
* [http://eclipsesource.com/blogs/2015/05/12/multithreaded-javascript-with-j2v8/ Multithreaded JavaScript with J2V8]
* [https://stackoverflow.com/questions/38848274/ Execute .js function with J2V8]
* [https://stackoverflow.com/questions/38848274/ Execute .js function with J2V8]
* [http://eclipsesource.com/blogs/2016/07/20/running-node-js-on-the-jvm/ Running Node JS on the JVM]
* [http://eclipsesource.com/blogs/2016/07/20/running-node-js-on-the-jvm/ Running Node JS on the JVM]
Line 43: Line 47:
* [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]
* [https://www.programcreek.com/java-api-examples/?api=com.eclipsesource.v8.V8Object V8Object]
| valign="top" |
* [https://www.eclipsecon.org/na2015/session/j2v8-highly-efficient-js-runtime-java J2V8 A Highly Efficient JS Runtime For Java]
* [http://eclipsesource.com/blogs/2015/11/04/shipping-j2v8-as-an-aar/ Shipping J2V8 as an AAR]
|}

Revision as of 17:55, 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>


References