java 如何安装 jTDS?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5075386/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 09:18:18  来源:igfitidea点击:

How to install jTDS?

javajdbc

提问by JavaNewb

In the FAQis written: "Just drop the jar file into your application's classpath"

常见问题解答中写道:“只需将 jar 文件放入应用程序的类路径中”

What that means?

那意味着什么?

Im using Eclipse

我正在使用 Eclipse

回答by Jon Skeet

It means exactly what it says. The classpath for a Java application is a list of directories and jar files that the classloader will use to find the classes you're using. You just need to make sure that the jtds jar file is in your classpath. Quite how you do this will depend on your application type. To run an app directly from Eclipse, you can just edit your project's build path to include the jar file... but if your app is running as a servlet within Tomcat (or something similar) the steps will be different.

这正是它所说的意思。Java 应用程序的类路径是一个目录和 jar 文件的列表,类加载器将使用它们来查找您正在使用的类。您只需要确保 jtds jar 文件在您的类路径中。您如何做到这一点取决于您的应用程序类型。要直接从 Eclipse 运行应用程序,您只需编辑项目的构建路径以包含 jar 文件……但是如果您的应用程序在 Tomcat(或类似的东西)中作为 servlet 运行,则步骤将有所不同。

If you're new to Java, I'd stronglyrecommend that you learn the basics (including the classpath) beforeyou start doing any JDBC work.

如果您不熟悉 Java,我强烈建议您开始任何 JDBC 工作之前学习基础知识(包括类路径)。

回答by Tomasz Nurkiewicz

If you are using command line:

如果您使用命令行:

java -cp jtds.jar:yourapplication.jar com.example.Main

If you are using Eclipse: How to Add JARs to Project Build Paths in Eclipse (Java).

如果您使用的是 Eclipse:如何将 JAR 添加到 Eclipse (Java) 中的项目构建路径

If you are using Maven, add this to your pom.xml:

如果您使用的是 Maven,请将其添加到您的pom.xml

<dependency>
    <groupId>net.sourceforge.jtds</groupId>
    <artifactId>jtds</artifactId>
    <version>1.2</version>
</dependency>

And change the title, the library is called jTDS.

并更改标题,该库名为jTDS。

回答by Miljan

You need to put .jar file in two places:

您需要将 .jar 文件放在两个地方:

First one is folder "libs" which contains external libraries. Second place is your classpath, where you load .jar file from folder "libs".

第一个是包含外部库的文件夹“libs”。第二个位置是您的类路径,您可以在其中从文件夹“libs”加载 .jar 文件。

Hope this works!

希望这有效!