Class.forName("oracle.jdbc.OracleDriver");不工作

Class.forName("oracle.jdbc.OracleDriver"); Not working

public class JdbcConnectionTest {

    public static void main(String[] args) throws Exception {
        // Dynamically loading the driver so that it will register.
        Class.forName("oracle.jdbc.OracleDriver");              
    }
}

当我 运行 上面的代码时,我得到以下异常:

Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver at java.net.URLClassLoader.run(URLClassLoader.java:372) at java.net.URLClassLoader.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:260) at JdbcConnectionTest.main(JdbcConnectionTest.java:14)

如果有人有答案,请告诉我。

尝试使用完全限定的 class 名称:oracle.jdbc.driver.OracleDriver