如何在 Windows 7 上安装 Connector/J?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5771166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I instal Connector/J on windows 7?
提问by Aaron
I need step by step instructions. I have downloaded if from the mysql website http://dev.mysql.com/usingmysql/java/
我需要分步说明。我已经从 mysql 网站http://dev.mysql.com/usingmysql/java/下载了 if
But now I am not to sure what to do from here? I'm sort of stuck..
但现在我不确定从这里开始做什么?我有点卡住了..
采纳答案by BalusC
Just put the JAR file in the runtime classpath. This is not environment-dependent.
只需将 JAR 文件放在运行时类路径中。这与环境无关。
How exactly to do that depends on what kind of application it is. If it's for example a plain vanilla Java application which you execute by java.exe
, then use the -cp
argument to specify the classpath.
如何做到这一点取决于它是什么类型的应用程序。例如,如果它是您执行的普通 Java 应用程序java.exe
,则使用该-cp
参数指定类路径。
java -cp .;/path/to/mysql.jar com.example.Foo
The classpath is basically a collection of paths to JAR files and/or .class
files where Java should look for class definitions.
类路径基本上是 JAR 文件和/或.class
Java 应在其中查找类定义的文件的路径的集合。
See also:
也可以看看:
- Java connectivity with MySQL- A mini tutorial
- Java 与 MySQL 的连接- 一个迷你教程
回答by user3299474
In a more direct form... Add the jar file to
以更直接的形式...将jar文件添加到
C:\Program Files\NetBeans 7.4\java\modules\ext
C:\Program Files\NetBeans 7.4\java\modules\ext
That being your version of netbeans and boom, good to go
那是您的 netbeans 和繁荣版本,一切顺利