Home > Back-end >  SQLcl is unable to find js engine to process js scripts
SQLcl is unable to find js engine to process js scripts

Time:11-03

When I want to run script written in js I get a message about missing js engine in my classpath:

SQL> script
  2  ctx.write('hi');
  3* /
js language engine not found
Please add js language engine to the classpath
SQL>

Here's my Java params:

PS C:\run_scripts_sqlcl> sql /nolog
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en


SQLcl: Release 21.3 Production on Tue Nov 02 17:54:24 2021

Copyright (c) 1982, 2021, Oracle.  All rights reserved.

SQL> show java
Java Detail
-----------
java.home= C:\Program Files\Java\jre1.8.0_291
java.vendor= Oracle Corporation
java.vendor.url= http://java.oracle.com/
java.version= 1.8.0_291
--------------------------------------------------------------------------------
os.arch= amd64
os.name= Windows 10
os.version= 10.0
path.separator= ;
file.separator= \
line.separator=

user.dir= C:\run_scripts_sqlcl
user.home= C:\Users\user
user.name= user
user.language= en
user.region= null
file.encoding= Cp1251
Used memory: 78.1MB
Max available memory: 1,820.5MB
--------------------------------------------------------------------------------
SQL_HOME=null
Classpath

--------------------------------------------------------------------------------
null

But when I call jjs right from Java/bin dir it works fine:

PS C:\Program Files\Java\jre1.8.0_291\bin> .\jjs.exe
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en
jjs> print('hi!')
hi!
jjs>

How can I add js engine to my classpath? Should I set some specific parameters?

CodePudding user response:

You have a JRE, the Java Runtime Engine doesn't include the Nashorn engine for processing your scripts, e.g. JavaScript.

Your options:

  • Grab a JDK (make sure that's 8 or 11 as Nashorn is removed in LTS post 11)
  • Grab a GraalVM to run SQLcl

In an upcoming release, we'll detect this is missing and offer to go get that for you when you try to run a script.

  • Related