Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 外部Jar未连接到Netbeans中的SQL_Java_Maven - Fatal编程技术网

Java 外部Jar未连接到Netbeans中的SQL

Java 外部Jar未连接到Netbeans中的SQL,java,maven,Java,Maven,我正在处理project.jar,而netbeans中的部署jar工作正常。 但如果我要用主Jar复制从属Jar和资源。 在连接SQL时,它给我提供了错误类未找到异常 请告知在部署时需要携带哪些文件,并解决此问题,它必须位于复制旁边的类路径中。你没有提到任何关于类路径的事情。请检查一下 类似%CLASSPATH%的内容:必须回答guy 在POM.xml中完成以下更改 <artifactId>maven-assembly-plugin</artifactId> <e

我正在处理project.jar,而netbeans中的部署jar工作正常。
但如果我要用主Jar复制从属Jar和资源。 在连接SQL时,它给我提供了错误类未找到异常


请告知在部署时需要携带哪些文件,并解决此问题,它必须位于复制旁边的类路径中。你没有提到任何关于类路径的事情。请检查一下

类似%CLASSPATH%的内容:

必须回答guy 在POM.xml中完成以下更改

<artifactId>maven-assembly-plugin</artifactId>

<executions>
  <execution>
    <phase>package</phase>
    <goals>
      <goal>single</goal>
    </goals>
  </execution>
</executions>
<configuration>
  <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
  </descriptorRefs>
  <archive>
    <manifest>
        <mainClass>com.connect.sql_connection.Connection</mainClass>
    </manifest>
  </archive>
</configuration>

而连接SQL则毫无意义。SQL是一种查询语言。你没有连接到它。这就像在连接Java时编写代码一样。请向我们显示您的代码和收到的确切错误消息。连接代码:Class.forNamecom.microsoft.sqlserver.jdbc.SQLServerDriver;con=DriverManager.getConnectionjdbc:sqlserver://localhost:1433;用户=sa;密码=abcd1234;数据库=abc;错误消息:-类未找到异常,Com.microsoft.sqlserver.jdbc.SQLServerDriver使用无DSNLess连接如果我将复制依赖Jar和资源到主Jar,您在哪里处理?现在我想部署到另一台计算机中。因此,出于测试目的,我正在处理同一台计算机中另一个文件夹中的必要内容lib、src、target、nbactions、,pom哪些内容需要复制为什么-1?是否愿意给出原因?可能其他人不喜欢你的答案%CLASSPATH%在windows中不存在,java类路径通过-cp选项提供或自动查找。请详细说明。部署需要携带哪些文件以及保存在何处的时间