Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

package com.ggl;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class TestOrcl2 {

        /**
         * 使用jdbc连接oracle
         */
        public static void main(String[] args) {
                 try {
                         //加载驱动
                        Class.forName("oracle.jdbc.driver.OracleDriver");
                         //得到连接
                        Connection ct=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:myorcl","system","orcl");
                        Statement sm=ct.createStatement();
                         ResultSet rSet=sm.executeQuery(" select * from test;");
                        
                         while (rSet.next()) {
                                
                                System.out.println("用户名:  "+rSet.getString(1));
                               
                        }
                        
                } catch (Exception e) {
                        e.printStackTrace();
                }

        }

}

运行结果:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(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)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.ggl.TestOrcl2.main(TestOrcl2.java:16)

t通过cmd命令差得jdk版本是1.6,环境变量配置正确,为何还会这样???

你可能感兴趣的:(oracle)