在终端中使用 JDBC 将 Java 连接到 Oracle 数据库
我正在尝试将 java 连接到终端内的 Oracle 数据库。我不太擅长终端,并且已经为此苦苦挣扎了 3 个多小时。有人可以向我解释如何正确设置 PATH 以便 java 可以看到必要的 jar 文件,以及如何配置我的路径,这样我就不必每次都输入安装 java 的路径编译并运行。我理解这是一个可以用谷歌搜索的问题,但我一直在遇到一个又一个的问题。请记住,我是通过 PuTTY 执行此操作,因为我不在计算机本身上。如果有人能花时间回答这个问题,我将不胜感激。
I'm trying to connect java to a Oracle database within terminal. I'm not very good at terminal and have been struggling with this for 3+ hours. Can someone explain to me how I can properly set my PATH so that java can see the necessary jar files, as well as how to configure my path so that I don't have to type in the path where java is installed everytime I want to compile and run. I undersatnd this is a question that can be googled, but I've been runninginto problem after problem. Please keep in mind that I'm doing this all through PuTTY as I am not on the machine itself. If someone could take the time to answer this question, I would really appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Java 无法使用 PATH 查找 jar 文件。它使用您传递给 java 命令的类路径(或使用 CLASSPATH 环境变量,但我不建议在本地终端会话之外使用它)找到它们:
要将 JDK 放在您的路径中,您需要添加
/bin
(或 Windows 上的\bin
)到 PATH 环境变量。阅读Java 教程的以下部分。
Java doesn't find jar files using the PATH. It finds them using the classpath you pass to the java command (or using the CLASSPATH environment variable, but I wouldn't recommend using it outside of a local terminal session):
To have the JDK in your path, you need to add
<JDK_PATH>/bin
(or<JDK_PATH>\bin
on Windows) to the PATH environment variable.Read the following section of the Java tutorial.