Skip to content

Year4000/J2V8

 
 

Repository files navigation

J2V8

Build Status Maven Central

J2V8 is a set of Java bindings for V8. J2V8 focuses on performance and tight integration with V8. It also takes a 'primitive first' approach, meaning that if a value can be accessed as a primitive, then it should be. This forces a more static type system between the JS and Java code, but it also improves the performance since intermediate Objects are not created.

We developed J2V8 as a high performance engine for our multi-platform mobile toolkit tabris.js and it is a great choice for executing JavaScript on Android devices.

Building J2V8

Building J2V8 requires building both the native parts and the Java library (.jar/.aar file). To build the native parts we first build node.js as a library and then statically link J2V8 to that. The Java parts are built with maven/gradle.

J2V8 uses a cross-platform, cross-compiling build-system written in Python.

Follow these steps to build J2V8 from source:

  1. clone the Node.js source code
    • python prepare_build.py
    • This will download & prepare the latest compatible Node.js version for use in J2V8
    • The Node.js source code will be cloned into the local node sub-directory, which is the expected default location for the J2V8 build
  2. build Node.js and the J2V8 library
    • python build.py --target linux --arch x64 --node-enabled --cross-compile
    • or shorthand
    • python build.py -t linux -a x64 -ne -x

For all available options, supported platforms and architectures you can consult the build-script help:

python build.py --help

Cross-Compiling

For cross-compiling J2V8 uses Docker (android, linux, windows) and Vagrant (macos). The full source-code (of both J2V8 and Node.js) on the build-host are just shared via mounted volumes with the Docker / Vagrant machines, so you can quickly make changes and perform builds fast.

To invoke a cross-compile build, simply invoke the build.py script as usual but add the --cross-compile, -x flag. This will automatically provision and run the necessary virtualization to run the requested build fully independent of your local environment.

Note: using Docker / Vagrant for cross-compiliation requires many gigabytes of harddrive space as well as downloading the required images & tools.

Tutorials

Articles

Presentations

Other Resources

Here is a list of articles I've written on J2V8 http://eclipsesource.com/blogs/tag/j2v8/.

Who is using J2V8?

Here are some projects that use J2V8:

License

The code is published under the terms of the Eclipse Public License, version 1.0.

Packages

No packages published

Languages

  • Java 72.1%
  • C++ 12.2%
  • C 8.8%
  • Python 3.4%
  • CMake 1.2%
  • HTML 1.0%
  • Other 1.3%