Skip to content

Java bindings for duktape JavaScript engine.

License

Notifications You must be signed in to change notification settings

TheLogicMaster/duktape4j

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This fork is for adding the ability to interrupt infinite JS loops in client code for my game, Robot Recharge

To build, good luck. The Maven jar task works, but the produced libraries need to be manually inserted into the generated archive. The GH Actions workflow should create all of the native libraries.

To test new builds, first delete /tmp/duktape4j-1.2.1/* to remove old extracted binaries.

duktape4j

duktape4j FOSSA Status License

Java binding for Duktape 2.5, a very compact embedded ECMAScript (JavaScript) engine.

duktape4j is Java port of duktape-android.

Supported Java Versions

Oracle & OpenJDK Java 8, 11.

Both the JRE and the JDK are suitable for use with this library.

Stability

This library is suitable for use in production systems.

Supported Platforms

  • Windows 8 & Windows 10 (64-bit) (MSVC 2017)
  • Ubuntu (64-bit) (gcc)
  • macOS Catalina (10.15) (clang)

How it is tested

duktape4j is regularly tested on github actions.

Integration with Maven

To use the official release of duktape4j, please use the following snippet in your pom.xml file.

Add the following to your POM's <dependencies> tag:

<dependency>
    <groupId>io.webfolder</groupId>
    <artifactId>duktape4j</artifactId>
    <version>1.2.1</version>
</dependency>

Download

duktape4j-1.2.1.jar - 1189 KB

Usage Examples

public class HelloWorld {

    public static interface Console {
        default void info(String message) {
            System.out.println(message);
        }
    }

    public static void main(String[] args) {
        try (Duktape duktape = Duktape.create()) {
            duktape.set("console", Console.class, new Console() { });
            duktape.evaluate("console.info('hello, world!')");
        }
    }
}

License

Licensed under the Apache License.

Note: The included C code from Duktape is licensed under MIT and duktape-android licensed under Apache.

FOSSA Status

About

Java bindings for duktape JavaScript engine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.7%
  • Java 3.5%
  • C 0.8%
  • C++ 0.6%
  • Batchfile 0.2%
  • Shell 0.1%
  • CMake 0.1%