7 Replies Latest reply on Feb 5, 2015 8:15 PM by thatJeffSmith-Oracle

    sqlcl java error on startup..setup question

    Thomas Owens

      Hello all,

       

      Appreciate all that is going into making a better equipped sql*plus type of tool.  I was trying to get sqlcl to work today for the first time, and it appears I'm hitting an immediate road block which appears to be related to my windows java situation.  Here is the error in question:

       

      C:\oracle\sqlcl\bin>sql -optl

      Exception in thread "main" java.lang.UnsupportedClassVersionError: oracle/dbtools/raptor/scriptrunner/cmdline/SqlCli (Un

      supported major.minor version 51.0)

              at java.lang.ClassLoader.defineClass0(Native Method)

              at java.lang.ClassLoader.defineClass(Unknown Source)

              at java.security.SecureClassLoader.defineClass(Unknown Source)

              at java.net.URLClassLoader.defineClass(Unknown Source)

              at java.net.URLClassLoader.access$100(Unknown Source)

              at java.net.URLClassLoader$1.run(Unknown Source)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(Unknown Source)

              at java.lang.ClassLoader.loadClass(Unknown Source)

              at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

              at java.lang.ClassLoader.loadClass(Unknown Source)

              at java.lang.ClassLoader.loadClassInternal(Unknown Source)

      C:\oracle\sqlcl\bin>

       

      Do you have any suggestions on how to correct this so that I can move forward?  Do I need to fiddle with sql.bat to identify the java_home?  if so, do you have an example?

       

      Thanks in advance for any assistance provided.

       

      Tom

        • 1. Re: sqlcl java error on startup..setup question
          thatJeffSmith-Oracle

          if you run

          java -version

           

          at a cmd prompt, what do you see?

          1 person found this helpful
          • 2. Re: sqlcl java error on startup..setup question
            Gary Graham-Oracle

            If you use both sqlcl and SQL Developer 4.1, you should install the latest update of jdk1.8.0.  If you only wish to use sqlcl, then the latest jre 1.7.0 update will suffice.

             

            In the sql.bat, you can include a set JAVA_HOME= line, something like

            set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31

            • 3. Re: sqlcl java error on startup..setup question
              Thomas Owens

              Jeff,

               

              Here is what I get:

              C:\>java -version

              java version "1.4.2_04"

              Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)

              Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

               

              That definitely doesn't look correct.  I checked my Java settings from the control panel and it doesn't list build 1.4.2 at all.  Any ideas?

               

              Gary,

               

              I have set both of these in sql.bat in separate tests:

              REM SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31

              SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_75

               

              Both resulted in same error:

               

              C:\oracle\sqlcl\bin>sql.bat

              Exception in thread "main" java.lang.UnsupportedClassVersionError: oracle/dbtools/raptor/scriptrunner/cmdline/SqlCli (Un

              supported major.minor version 51.0)

                      at java.lang.ClassLoader.defineClass0(Native Method)

                      at java.lang.ClassLoader.defineClass(Unknown Source)

                      at java.security.SecureClassLoader.defineClass(Unknown Source)

                      at java.net.URLClassLoader.defineClass(Unknown Source)

                      at java.net.URLClassLoader.access$100(Unknown Source)

                      at java.net.URLClassLoader$1.run(Unknown Source)

                      at java.security.AccessController.doPrivileged(Native Method)

                      at java.net.URLClassLoader.findClass(Unknown Source)

                      at java.lang.ClassLoader.loadClass(Unknown Source)

                      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                      at java.lang.ClassLoader.loadClass(Unknown Source)

                      at java.lang.ClassLoader.loadClassInternal(Unknown Source)

               

              Going to guess it has something with my default in cmd.exe showing up as 1.4.2 for some reason.  Will dig around to see how I can correct that, but please let me know if you have further suggestion.  I appreciate the assistance from you both!

               

              Thanks,

              Tom

              • 4. Re: sqlcl java error on startup..setup question
                Gary Graham-Oracle

                Tom,

                 

                The download page for JDK 1.8 is Java SE Development Kit 8 - Downloads

                 

                Note that after downloading the appropriate file for your O/S, and beginning the installation, the JDK gets installed first, then it will ask if you also wish to install the public JRE. If you accept installing the Public JRE, then your problem with having that old JRE as your default will go away,

                 

                I believe it has been several months since Oracle made 1.8 the preferred version over 1.7 for those users taking advantage of the automatic Java updates.


                Regards,

                Gary

                1 person found this helpful
                • 5. Re: sqlcl java error on startup..setup question
                  Thomas Owens

                  Update:

                   

                  Issue was definitely the java version showing a very old 1.4.  The misconfiguration was in my windows PATH env variable, which contained a very old java version tied to an old Oracle BI install I had. 


                  The fix was to remove all references to this old java location in the path variable.  Once that happened, I was able to fire up sqlcl immediately without issue.

                   

                  Many thanks for the suggestions Jeff.  Definitely the eureka moment I needed to sort it out.

                   

                  Now to start having fun with this new tool!

                   

                  Thanks,

                  Tom

                  • 6. Re: sqlcl java error on startup..setup question

                    Then please mark the thread ANSWERED.


                    • 7. Re: sqlcl java error on startup..setup question
                      thatJeffSmith-Oracle

                      Excellent! I always feel good when my hunch is closer to right than wrong