尝试设置Java DB:“未找到类:无法加载JDBC驱动程序org.apache.derby.jdbc.EmbeddedDriver". [英] Trying to set up Java DB: "Class Not Found: JDBC driver org.apache.derby.jdbc.EmbeddedDriver could not be loaded"

查看:159
本文介绍了尝试设置Java DB:“未找到类:无法加载JDBC驱动程序org.apache.derby.jdbc.EmbeddedDriver".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对SQL完全陌生,我正在尝试建立一个数据库来练习使用它.

I'm completely new to SQL, and I'm trying to set up a database to practice using it.

我在Windows 7上.

I'm on Windows 7.

我正在关注Oracle的JDBC基础知识教程( http://docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html#step1 )并到目前为止:

I'm following Oracle's JDBC Basics tutorial (http://docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html#step1) and have so far:

  1. 已安装JDK(他们说要安装Java SE SDK,但据我所知,JDK和Java SE SDK大致相同吗?)

  1. Installed JDK (they say to install Java SE SDK, but as far as I can tell, JDK and Java SE SDK are more or less the same?)

安装了Apache Ant.

Installed Apache Ant.

下载了示例代码.

修改了build.xml.

Modified the build.xml.

修改了教程属性文件.

进入计算机->属性->高级系统...->环境变量并添加PATH(C:\ Program \ Java \ jdk1.7.0_25 \ bin;%ANT_HOME%/bin; C:\Windows; C:\ Windows \ system32).

Gone into Computer -> Properties -> Advanced System... -> Environment Variables and added PATH (C:\Program\Java\jdk1.7.0_25\bin;%ANT_HOME%/bin;C:\Windows;C:\Windows\system32).

我转到cmd,更改目录并运行ant jar.它符合要求.

I go to cmd, change directory and run ant jar. It complies successfully.

我运行ant setup(应该用来创建数据库),并且收到以下错误消息:

I run ant setup (which is supposed to create the database), and I get this error message:

构建文件:C:\ Program \ Java \ JDBCTutorial \ build.xml

Buildfile: C:\Program\Java\JDBCTutorial\build.xml

设置:

放置表:

构建失败C:\ Program \ Java \ JDBCTutorial \ build.xml:140:以下内容执行此行时发生错误:C:\ Program \ Java \ JDBCTutorial \ build.xml:83:找不到类:JDBC无法加载驱动程序org.apache.derby.jdbc.EmbeddedDriver

BUILD FAILED C:\Program\Java\JDBCTutorial\build.xml:140: The following error occurred while executing this line: C:\Program\Java\JDBCTutorial\build.xml:83: Class Not Found: JDBC driver org.apache.derby.jdbc.EmbeddedDriver could not be loaded

总时间:0秒

我不知道我是否有JDBC驱动程序-教程说它们包含在下载中,但是我不知道在哪里寻找它们进行验证.我还认为PATH变量可能有问题.我还看到有人提到类路径可能存在问题,但我不知道该如何解决.

I don't know if I have the JDBC drivers - the tutorial says they're included in the download, but I don't know where to look for them to verify. I'm also thinking there might be something wrong with the PATH variable. I've also seen people mention there could be problems with the classpath, but I don't know how to fix that.

推荐答案

因此,您需要添加缺少的lib.您可以在此处下载 http://db.apache.org/derby/derby_downloads.html然后配置 JAVADBDRIVER 指向jar文件.

So you need to add the missing lib. You can download it here http://db.apache.org/derby/derby_downloads.html Then configure JAVADBDRIVERto point to the jar file.

JAVADBDRIVER Java DB驱动程序的完整路径名.这是通常是/lib/derby.jar.

JAVADBDRIVER The full path name of your Java DB driver. This is typically /lib/derby.jar.

这篇关于尝试设置Java DB:“未找到类:无法加载JDBC驱动程序org.apache.derby.jdbc.EmbeddedDriver".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆