Forum Stats

  • 3,751,029 Users
  • 2,250,300 Discussions
  • 7,867,264 Comments

Discussions

SQLcl.exe giving Java error Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not loa

1002330
1002330 Member Posts: 20
edited Aug 17, 2018 7:18AM in SQLcl

Hello Folks,

I am trying to connect sqlcl to our database but its giving me the error below -

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no jansi in java.library.path, Access is denied]

        at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)

        at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)

        at org.fusesource.jansi.internal.CLibrary.<clinit>(CLibrary.java:37)

        at oracle.dbtools.raptor.console.clone.DbtoolsConsoleReader.<init>(DbtoolsConsoleReader.java:245)

        at oracle.dbtools.raptor.console.clone.DbtoolsConsoleReader.<init>(DbtoolsConsoleReader.java:238)

        at oracle.dbtools.raptor.console.SQLPlusConsoleReader.<init>(SQLPlusConsoleReader.java:35)

        at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.startConsole(SqlCli.java:235)

        at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.<init>(SqlCli.java:216)

        at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.main(SqlCli.java:427)

I have jre1.8.0_161 folder in the sqlcl folder. I have got the Java_Home link to sqlcl/jre1.8.0_161 and I in my path variable i have added %JAVA_HOME%\bin. I am lost at why its giving me this error. Any help is appreciated. Thank you!

«1

Answers

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited Jan 30, 2018 2:29PM

    SQLcl will first look for the existence of sqlcl\jre, not sqlcl\jre<specific_version>.  So you need something like...

    SQLclWithEmbeddedJRE.jpg

    The list of rules are in , shown below for convenience (Windows)...

    1. If a JRE is copied into a sqlcl\jre folder, then SQLcl uses that Java version.2. Otherwise, running sql.bat uses an explicitly set JAVA_HOME, followed by the Java version appearing first in PATH.3. Otherwise, running sql.exe first checks the Windows Registry for which Java version to use, then falls through to the rules in (2).
  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited Jan 30, 2018 4:54PM

    In addition, make sure your SQLcl install contains the file jline.jar in the sqlcl\lib directory.  That is where the jansi stuff resides.  Perhaps the utility you used to extract from the sqlcl zip did not do the job properly.

  • 1002330
    1002330 Member Posts: 20
    edited Jan 30, 2018 9:24PM

    Thank you Gary for the response. I checked for jline.jar and it is there. Please forgive me for my silly question but here it goes - In your first comment you mentioned JRE should be in the path of SQLcl and that makes sense. I changed the name of JRE folder to just "JRE" instead of JRE<version>, however, should the SQLcl's lib and bin files reside IN the JRE bin files? That doesn't make sense right? I guess I am confused in where the SQLcl's lib & bin files should reside in order for it to work. Again, thanks for your help!

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited Jan 30, 2018 9:52PM

    No worries.  I also should have provide this screenshot of the folder structure at the next level up, the level where the embedded jre folder is a sibling of the lib and bin folders that come with SQLcl.  The jre, of course, has its own bin and lib folders, as shown in my prior post.

    SQLclWithEmbeddedJREasSiblingToSQLclBin+Lib.jpg

    So renaming that JRE<version> to simply JRE is what I intended.

  • 1002330
    1002330 Member Posts: 20
    edited Jan 31, 2018 9:42AM

    Thanks for the response Graham. I re installed/extracted SQLcl to my program files. Grabbed JRE folder and stuck it as a sibling in the SQLcl folder like this:

    pastedImage_1.png

    And then went to the SQLcl's bin folder where my sql.exe and sql.bat files are residing and tried to run sql but I get the same error.

    pastedImage_0.png

  • 1002330
    1002330 Member Posts: 20
    edited Jan 31, 2018 11:47AM

    I have SQLDeveloper set up and it works fine. I read somewhere that sqlcl comes with the developer and so I started looking for it and there it was. The sql.exe and sql.bat files were in my C:\Program Files\sqldeveloper\sqldeveloper\bin folder. So I tried to run it from there and I got the same error as above. This is very strange!

  • 1002330
    1002330 Member Posts: 20
    edited Jan 31, 2018 11:48AM

    Here is the screenshot:

    pastedImage_0.png

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited Jan 31, 2018 1:01PM

    I agree, this is very strange.  I have a superstition about never installing SQLcl or SQL Developer under C:\Users or C:\Program Files, but I doubt that is causing you any problems because I can launch SQLcl in either scenario...

    SQLclLaunchFromProgramFiles.JPG

    And if you actually could open SQLcl successfully and run the show java command, you would see jline.jar in the ClassPath...

    SQLclShowJava.jpg

    There must be something configured incorrectly in your environment, but I am at a bit of a loss what that might be.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited Jan 31, 2018 1:06PM

    As an alternative, you might want to try launching SQLcl with the sql.bat command.  And, in fact, I do see something strange in your last screenshot:  why is sql.exe dated today at 01/31/2018 9:15 AM?

  • 1002330
    1002330 Member Posts: 20
    edited Jan 31, 2018 2:08PM

    Tried sql.bat - a window comes up for less than a second and goes away. I think since I tried to run sql.exe today its dating today.