java - 在netbeans ide中仅创建项目的一个包的jar文件

标签 java jar

我会创建一个仅包含一个属于我的项目的包的 jar。这个包包含一个主类。我该怎么办?

最佳答案

来自jar documentation :

jar cf jar-file input-file(s)

...
* The input-file(s) argument is a space-separated list of one or more files that you want to include in your JAR file. 
The input-file(s) argument can contain the wildcard * symbol. If any of the "input-files" are directories, the contents of those directories are added to the JAR archive recursively.

因此您可以将路径指定为包:

jar cf <jar file name> com/companyname/package/ 

关于java - 在netbeans ide中仅创建项目的一个包的jar文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11483473/

相关文章:

java - 未使用调试标志编译的调试 jar

Java应用程序在Windows服务器上的可能性?

java - 调整 apache commons 日志的日志级别?

java - 查找并比较单个字符串中的单词。 java

java - 设置 JFrame 的不透明度时使用 float 和 BigDecimal 缺乏精度

maven - Spring boot - 抛出异常 jar 不存在

java - 如何深度复制具有初始容量的 map ?

java - 在 jar 中打包标签文件

java - SCons 在创建 jar 时没有获取所有类文件

java - 如何使用 maven 下载 JavaMail (mail.jar) 和 JAF (activation.jar)