<i id='ZNt9d'><tr id='ZNt9d'><dt id='ZNt9d'><q id='ZNt9d'><span id='ZNt9d'><b id='ZNt9d'><form id='ZNt9d'><ins id='ZNt9d'></ins><ul id='ZNt9d'></ul><sub id='ZNt9d'></sub></form><legend id='ZNt9d'></legend><bdo id='ZNt9d'><pre id='ZNt9d'><center id='ZNt9d'></center></pre></bdo></b><th id='ZNt9d'></th></span></q></dt></tr></i><div id='ZNt9d'><tfoot id='ZNt9d'></tfoot><dl id='ZNt9d'><fieldset id='ZNt9d'></fieldset></dl></div>

    • <bdo id='ZNt9d'></bdo><ul id='ZNt9d'></ul>
  • <legend id='ZNt9d'><style id='ZNt9d'><dir id='ZNt9d'><q id='ZNt9d'></q></dir></style></legend>

    <small id='ZNt9d'></small><noframes id='ZNt9d'>

    <tfoot id='ZNt9d'></tfoot>

        无法加载 com.mysql.jdbc.Driver

        时间:2023-08-21
      1. <small id='2XN3w'></small><noframes id='2XN3w'>

            <tbody id='2XN3w'></tbody>

                <bdo id='2XN3w'></bdo><ul id='2XN3w'></ul>
                <legend id='2XN3w'><style id='2XN3w'><dir id='2XN3w'><q id='2XN3w'></q></dir></style></legend>
                <i id='2XN3w'><tr id='2XN3w'><dt id='2XN3w'><q id='2XN3w'><span id='2XN3w'><b id='2XN3w'><form id='2XN3w'><ins id='2XN3w'></ins><ul id='2XN3w'></ul><sub id='2XN3w'></sub></form><legend id='2XN3w'></legend><bdo id='2XN3w'><pre id='2XN3w'><center id='2XN3w'></center></pre></bdo></b><th id='2XN3w'></th></span></q></dt></tr></i><div id='2XN3w'><tfoot id='2XN3w'></tfoot><dl id='2XN3w'><fieldset id='2XN3w'></fieldset></dl></div>

                  <tfoot id='2XN3w'></tfoot>
                  本文介绍了无法加载 com.mysql.jdbc.Driver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  当我为 Testng 应用程序运行 ant 时,我无法加载 com.mysql.jdbc.Driver.

                  when I run ant for a Testng application, I am unable to load com.mysql.jdbc.Driver.

                  下面是抛出的异常.

                  [testng] java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
                  [testng] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
                  [testng] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
                  [testng] at java.security.AccessController.doPrivileged(Native Method)
                  

                  谢谢和问候,斯里坎特

                  推荐答案

                  CLASSPATH 环境变量java.exe 使用命令,甚至只有在没有任何-cp-classpath-jar参数时使用.它被 IDE 忽略.

                  The CLASSPATH environment variable is only used by the java.exe command and even then only when used without any of the -cp, -classpath, -jar arguments. It is ignored by IDE's.

                  该环境变量在现实世界中也被认为是一种糟糕的做法,因为它破坏了可移植性.对于 Sun 来说,防止初学者厌倦在 -cp-classpath 参数中一遍又一遍地输入相同的类路径只是有用"的.在现实世界中,首选批处理/shell 文件.

                  That environment variable is in real world also considered a poor practice since it breaks portability. It's only "useful" for Sun to prevent that starters get tired of typing the same classpath again and again in the -cp or -classpath arguments. In real world, batch/shell files are preferred.

                  如果您使用的是 IDE,则类路径称为构建路径"(它代表编译时和运行时类路径).您可以在项目的属性中对其进行配置.您可以添加一个完整的文件夹,您可以添加单个/外部 JAR 文件,您可以链接项目等.好好利用它.忘记整个 CLASSPATH 环境变量.

                  If you're using an IDE, The classpath is called the "build path" (it represents both compiletime and runtime classpath). You can configure it in the project's properties. You can add a complete folder, you can add individual/external JAR files, you can link projects, etcetera. Make use of it. Forget the whole CLASSPATH environment variable.

                  对于命令提示符,

                  您必须将 jarfile 的完整路径放在类路径中(包括文件名):

                  You have to put the full path to the jarfile in the classpath (including the filename):

                  .;C:\j2sdk1.4.2_16\jre\lib;
                  C:\Program Files\mysql-connector-java-3.1.144\mysql-connector-java-3.1.14-bin.jar
                  

                  正如河马所说,更改后必须重新启动cmd.如果它不起作用,请像这样启动您的程序:

                  As Hippo said, you have to restart cmd after changing that. If it doesn't work, launch your program like this:

                  java -cp ".;C:\j2sdk1.4.2_16\jre\lib;
                  C:\Program Files\mysql-connector-java-3.1.144\mysql-connector-java-3.1.14-bin.jar"
                  my.class.Name
                  

                  这篇关于无法加载 com.mysql.jdbc.Driver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                • <i id='CNYg8'><tr id='CNYg8'><dt id='CNYg8'><q id='CNYg8'><span id='CNYg8'><b id='CNYg8'><form id='CNYg8'><ins id='CNYg8'></ins><ul id='CNYg8'></ul><sub id='CNYg8'></sub></form><legend id='CNYg8'></legend><bdo id='CNYg8'><pre id='CNYg8'><center id='CNYg8'></center></pre></bdo></b><th id='CNYg8'></th></span></q></dt></tr></i><div id='CNYg8'><tfoot id='CNYg8'></tfoot><dl id='CNYg8'><fieldset id='CNYg8'></fieldset></dl></div>

                  <small id='CNYg8'></small><noframes id='CNYg8'>

                  <tfoot id='CNYg8'></tfoot>
                    <tbody id='CNYg8'></tbody>
                    <bdo id='CNYg8'></bdo><ul id='CNYg8'></ul>

                    • <legend id='CNYg8'><style id='CNYg8'><dir id='CNYg8'><q id='CNYg8'></q></dir></style></legend>