gpt4 book ai didi

java - 如何从我的项目构建 jar 文件?

转载 作者:行者123 更新时间:2023-11-29 02:06:12 26 4
gpt4 key购买 nike

我用 javamysql 写了一个程序,现在我想要一个 jar 文件,当我点击它时程序运行(没有那个 mysql在我的系统上安装)。

我右键单击我的项目并按下清理并构建,但它没有构建 jar 文件及以下

写入输出。

Updating property file: C:\Users\mehdi\Documents\NetBeansProjects\project1\build\built-clean.properties
Deleting directory C:\Users\mehdi\Documents\NetBeansProjects\project1\build
clean:
init:
deps-jar:
Created dir: C:\Users\mehdi\Documents\NetBeansProjects\project1\build
Updating property file: C:\Users\mehdi\Documents\NetBeansProjects\project1\build\built-jar.properties
Created dir: C:\Users\mehdi\Documents\NetBeansProjects\project1\build\classes
Created dir: C:\Users\mehdi\Documents\NetBeansProjects\project1\build\empty
Compiling 8 source files to C:\Users\mehdi\Documents\NetBeansProjects\project1\build\classes
C:\Users\mehdi\Documents\NetBeansProjects\project1\src\project1\NewUser.java:24: package sun.swing.table does not exist
import sun.swing.table.DefaultTableCellHeaderRenderer;

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
C:\Users\mehdi\Documents\NetBeansProjects\project1\nbproject\build-impl.xml:595: The following error occurred while executing this line:
C:\Users\mehdi\Documents\NetBeansProjects\project1\nbproject\build-impl.xml:276: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)

现在我想知道如何从我的程序构建一个 jar 文件,该文件在没有安装 mysql 的情况下也能正常工作。

I use net beans 6.9.1

and jdk-6u23-windows-i586

最佳答案

我遇到了同样的问题。为了使事情正常进行,我将其添加到 pom.xml 文件中...

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<bootclasspath>${java.home}\lib\rt.jar</bootclasspath>
</compilerArguments>
</ configuration>
</plugin>

关于java - 如何从我的项目构建 jar 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5541316/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com