Can there be gradle/groovy code analog for launch of java -Djava.library.path=lib -jar lib/avatar-js.jar helloWorld.js, that is lanching .js file with Java 8 and passing some libs
or using defined dependencies
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
repositories {
    maven {
        url "https://maven.java.net/content/repositories/public/"
    }
}
dependencies {
    compile "com.oracle:avatar-js:0.10.25-SNAPSHOT"
    compile "com.oracle:libavatar-js-win-x64:0.10.25-SNAPSHOT"
}
task copyLibs(type: Copy) {
    from configurations.compile
    into 'lib'
}
sourceSets {
    main {
        java {
            srcDir 'src'
        }
        resources {
            srcDir 'src '
        }
    }
}
The only related docs I found (Build and run a jar inside of a Gradle task) is line from Chapter 45. The Application Plugin
 startScripts   jar     CreateStartScripts  Creates OS specific scripts to run the project as a JVM application.
Application plugins is Java dependent, no way to define task for JavaScript or C/C++
CreateStartScripts requires String mainClassName (not file to run)
Sources at https://github.com/PaulVI/NashornSandbox