Announcing J2V8 4

July 20, 2016 | 2 min Read

After over a year of development, I am very excited to announce that J2V8 4 is publicly available on all supported platforms. J2V8 is a set of V8 bindings for Java. This means that you can embed V8 (Google’s ultra fast JavaScript engine) into your Java applications. J2V8 4 is built on Node.js, which means you can also integrate Node.js with the JVM (On Windows, Mac and Linux).

J2V8-with-no-2-and-J

The biggest change in J2V8 4 is the use of V8 4.x, which enables many ES6 features.

public static void main(String[] args) {
  V8 v8 = V8.createV8Runtime();
  int x = (Integer) v8.executeScript("var func = x => x * x; func(5);");
  System.out.println(x);
  v8.release();
}

A number of notable features have been included in J2v8 4. I will expand on each of these further:

  1. Running Node.js on the JVM
  2. ByteBuffer backed TypedArrays (Shared memory between Java and V8)
  3. UTF-16 Support
  4. JavaScript functions written entirely in Java
  5. Improved Memory Management API

In addition to these New and Noteworthy features, a number of new APIs have been added. It’s easier to call JavaScript functions from Java, the memory model for callbacks has been improved, and build instructions have been published.

The technical version is 4.5.0 because we had a number of pre-releases for single platforms. This is the first time that all this work has been released for all supported platforms. J2V8 currently supports: Windows 32, Windows 64, MacOS, Linux 64, Android ARM and Android x86 (The Node.js integration is not available in the Android builds).

You can use J2V8 4 today by adding the following dependency to your pom.xml file.

com.eclipsesource.j2v8
  j2v8_macosx_x86_64
  4.5.0

The artifacts are system dependent because they include native libraries. Replace the artifactId for other platforms:

  • j2v8_macosx_x86_64
  • j2v8_win32_x86_64
  • j2v8_win32_x86
  • j2v8_linux_x86_64

Or use the following pom dependency to consume an Android AAR archive for Arm and x86:

com.eclipsesource.j2v8
  j2v8
  4.5.0
  aar

For more news on J2V8, follow me on Twitter.

Ian Bull

Ian Bull

Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.

He leads the J2V8 project and has served on several …