Skip to content

caoccao/Javet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Javet

Maven Central Discord Donate

Linux x86_64 Build MacOS x86_64 Build MacOS arm64 Build Windows x86_64 Build Android Node Build Android V8 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://blog.caoccao.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

CPU Arch Android Linux MacOS Windows
x86 βœ”οΈ ❌ ❌ ❌
x86_64 βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
arm βœ”οΈ ❌ ❌ ❌
arm64 βœ”οΈ βœ”οΈ βœ”οΈ ❌
  • Node.js v22.9.0 + V8 v13.0.245.16
  • Dynamic switch between Node.js and V8 mode
  • 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
  • AST analysis with swc4j
  • JS, TS, JSX, TSX transformation and transpilation with swc4j
  • Live interaction with JavetShell

Quick Start

Dependency

Maven

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

<!-- Linux (arm64) -->
<dependency>
    <groupId>com.caoccao.javet</groupId>
    <artifactId>javet-linux-arm64</artifactId>
    <version>4.0.0</version>
</dependency>

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

Gradle Kotlin DSL

implementation("com.caoccao.javet:javet:4.0.0") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-linux-arm64:4.0.0") // Linux (arm64)
implementation("com.caoccao.javet:javet-macos:4.0.0") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android-node:4.0.0") // Android Node (arm, arm64, x86 and x86_64)
implementation("com.caoccao.javet:javet-android-v8:4.0.0") // Android V8 (arm, arm64, x86 and x86_64)

Gradle Groovy DSL

implementation 'com.caoccao.javet:javet:4.0.0' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-linux-arm64:4.0.0' // Linux (arm64)
implementation 'com.caoccao.javet:javet-macos:4.0.0' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android-node:4.0.0' // Android Node (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet-android-v8:4.0.0' // Android V8 (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());
}

Sponsors

HiveMQ | SheetJS

License

APACHE LICENSE, VERSION 2.0

Blog

Documents