Skip to content

caoccao/Javet

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
September 13, 2021 09:46
cpp
September 14, 2023 09:49
September 14, 2023 09:49
September 14, 2023 09:49
src
September 14, 2023 09:49
August 16, 2021 11:10
December 8, 2021 10:51
February 15, 2021 11:18
February 15, 2021 11:18
February 15, 2021 11:18

Javet

Maven Central Discord Donate

Linux Build MacOS Build Android Build

Javet is Java + V8 (JAVa + V + EighT). It is an awesome way of embedding Node.js and V8 in Java.

If you like my work, please Star this project. And, you may follow me @sjtucaocao, or visit https://sjtucaocao.medium.com/ or https://caoccao.blogspot.com/. And the official support channel is at discord.

πŸ’– If you like my work, please donate to support me. If you have a retired Mac OS (x86_64) device and are fine with mailing it to me, that will be great because I don't have such device to support the community. Thank you for supporting Javet.

Major Features

  • Linux (x86_64) + Mac OS (x86_64, arm64) + ️Windows (x86_64)
  • Android (arm, arm64, x86 and x86_64)
  • Node.js v18.17.1 + V8 v11.7.439.16
  • Dynamic switch between Node.js and V8 mode (Which mode do you prefer?)
  • Polyfill V8 mode with Javenode
  • V8 API exposure in JVM
  • JavaScript and Java interop
  • Native BigInt and Date
  • Javet engine pool
  • Easy spring integration
  • Live debug with Chrome DevTools

Quick Start

Dependency

Maven

<!-- Linux and Windows (x86_64) -->
<dependency>
    <groupId>com.caoccao.javet</groupId>
    <artifactId>javet</artifactId>
    <version>2.2.3</version>
</dependency>

<!-- Mac OS (x86_64 and arm64) -->
<dependency>
    <groupId>com.caoccao.javet</groupId>
    <artifactId>javet-macos</artifactId>
    <version>2.2.3</version>
</dependency>

Gradle Kotlin DSL

implementation("com.caoccao.javet:javet:2.2.3") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-macos:2.2.3") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android:2.2.3") // Android (arm, arm64, x86 and x86_64)

Gradle Groovy DSL

implementation 'com.caoccao.javet:javet:2.2.3' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:2.2.3' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:2.2.3' // Android (arm, arm64, x86 and x86_64)

Hello Javet

// Node.js Mode
try (V8Runtime v8Runtime = V8Host.getNodeInstance().createV8Runtime()) {
    System.out.println(v8Runtime.getExecutor("'Hello Javet'").executeString());
}

// V8 Mode
try (V8Runtime v8Runtime = V8Host.getV8Instance().createV8Runtime()) {
    System.out.println(v8Runtime.getExecutor("'Hello Javet'").executeString());
}

License

APACHE LICENSE, VERSION 2.0.

Documents