Forum Stats

  • 3,750,416 Users
  • 2,250,175 Discussions
  • 7,866,972 Comments

Discussions

issue running .js scripts in sqlcl 21.2

esears1
esears1 Member Posts: 85 Blue Ribbon

I have a login script that will run a javascript file that basically sets my sqlprompt (it is based on the one by Kris Rice). It was working fine until I upgraded to sqlcl 21.2. Is there something different in 21.2 in order to run javascript files? Anytime i run a .js script file all I get is the following:

SQL> script c:\users\xxxx\source\scripts\oracle\sqlcl\newprompt.js

!ScriptCommand.1!SQL>

SQL>


It never changes the prompt. anyone experience the same?

«1

Comments

  • user832387
    user832387 Member Posts: 18 Blue Ribbon

    Yes I am having same problem with .js script.

    Additionally 21.2 also adding lots of extra lines for any command I issue at prompt

  • esears1
    esears1 Member Posts: 85 Blue Ribbon

    I tried other .js scripts that I have to make sure it has nothing to do with the login prompt script ( since they added the new feature of the statusbar) and it doesn't matter what .js script it is the only output I get is the !ScriptCommand.1! message. Not sure what that means.

  • bazzza
    bazzza Member Posts: 1,157 Silver Badge

    Yes, I get the same behaviour....

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 7,906 Employee

    What java are you running? Newer javas won't have Nashorn, so the js won't run

    You would then want to get GraalVM and use that, or just go get Java 11, latest update.

  • PJH
    PJH Member Posts: 6 Red Ribbon
    edited Aug 10, 2021 7:48AM

    Hi

    I have this issue and I am running Java 1.8.0_271 taken from SQLDeveloper 20.4.1:-

    SQLcl: Release 21.2 Production on Tue Jul 27 17:59:39 2021
    
    Copyright (c) 1982, 2021, Oracle. All rights reserved.
    
    SQL> show java
    Java Detail
    -----------
    java.home= C:\Applications\Sqldeveloper\sqlcl-21.2\jdk\jre
    java.vendor= Oracle Corporation
    java.vendor.url= http://java.oracle.com/
    java.version= 1.8.0_271
    

    So I in fact need a later or different JVM?

    Thanks

    Pete

  • esears1
    esears1 Member Posts: 85 Blue Ribbon

    Hi Jeff,

    I am running the following version of 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


    ~Edward

  • bazzza
    bazzza Member Posts: 1,157 Silver Badge

    It isn't my java, the same jave version is in use by sqlcl 21.2 and 20.4, the scripts work under 20.4 -

    SQL> sho java

    Java Detail

    -----------

    java.home= C:\Program Files (x86)\Java\jre1.8.0_251

    java.vendor= Oracle Corporation

    java.vendor.url= http://java.oracle.com/

    java.version= 1.8.0_251

    --------------------------------------------------------------------------------

    os.arch= x86

    os.name= Windows 10

    os.version= 10.0

    path.separator= ;

    file.separator= \

    line.separator=


    user.dir= C:\DBA\SQL_Scripts\sqlcl

    user.home= C:\Users\b_*****

    user.name= B_*****

    user.language= en

    user.region= null

    file.encoding= Cp1252

    Used memory: 45.3MB

    Max available memory: 247.5MB

    --------------------------------------------------------------------------------

    SQL_HOME=null

    Classpath



    when I run up sqlcl 20.4 (where the same login.js works):


    SQL> sho java

    Java Detail

    -----------

    java.home= C:\Program Files (x86)\Java\jre1.8.0_251

    java.vendor= Oracle Corporation

    java.vendor.url= http://java.oracle.com/

    java.version= 1.8.0_251

    --------------------------------------------------------------------------------

    os.arch= x86

    os.name= Windows 10

    os.version= 10.0

    path.separator= ;

    file.separator= \

    line.separator=


    user.dir= C:\DBA\SQL_Scripts\sqlcl

    user.home= C:\Users\b_*****

    user.name= B_*****

    user.language= en

    user.region= null

    file.encoding= Cp1252

    --------------------------------------------------------------------------------

    SQL_HOME=null

    Classpath


    --------------------------------------------------------------------------------

    null

  • PJH
    PJH Member Posts: 6 Red Ribbon
    edited Aug 3, 2021 2:27PM

    Hi

    I installed Java 11 and running the JS now works.

    I did find that to stop SQLcl asking for a Java 1.8 install and opening up a Browser tab, I had to put the contents of the jdk subdirectory from the Java 11 distribution into a "jre" subdirectory i.e. jdk/jre

    I downloaded Java 11 from:-

    https://www.oracle.com/webapps/redirect/signon?nexturl=https://download.oracle.com/otn/java/jdk/11.0.11%2B9/ab2da78f32ed489abb3ff52fd0a02b1c/jdk-11.0.11_windows-x64_bin.zip


    ./java -version

    java version "11.0.11" 2021-04-20 LTS

    Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)

    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)

    Regards

    Pete

  • User800507-Oracle
    User800507-Oracle Member Posts: 28 Employee

    Launcher will use ..\..\jdk\jre\bin\java.exe if finds. One can put Java 11 in this directory or just create a Windows symlink (soft link) to jre needed

    mklink /D ....

  • bazzza
    bazzza Member Posts: 1,157 Silver Badge

    The release note states (https://www.oracle.com/tools/sqlcl/sqlcl-relnotes-212.html#known) that only Java 1.8 is required.


    using java 11 invokes licensing requirements, so is not an option...

    Either there is a bug or the release notes are wrong...