使用 Intellij 创建 Java 库 jar

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

creating java library jars with intellij

javajarintellij-idea

提问by nagavamsikrishna

I am trying to create a library jar out of the compiled java files or a piece of code organized into directories. When I create the jar file using eclipse and use it in the actual code it is working fine but when i use intellij to create the jar file, the code is not able to find the packages which are in the jar file. when i compare the two jar files(the one created by eclipse and the one created by intellij), they have the same directory structure and both have manifest files with dummy information. What could i be doing wrong here. I think i am missing something obvious.

我正在尝试从编译的 java 文件或组织到目录中的一段代码中创建一个库 jar。当我使用 eclipse 创建 jar 文件并在实际代码中使用它时它工作正常但是当我使用 intellij 创建 jar 文件时,代码无法找到 jar 文件中的包。当我比较两个 jar 文件(一个由 eclipse 创建的一个和一个由 intellij 创建的)时,它们具有相同的目录结构,并且都有带有虚拟信息的清单文件。我在这里做错了什么。我想我错过了一些明显的东西。

Thanks

谢谢

edit: The question is answered, I need to put the 'compiled output' into the jar ; i was manually adding the compiled class files to jar and for some reason it did not work.

编辑:问题已回答,我需要将“编译输出”放入 jar 中;我手动将编译后的类文件添加到 jar 中,但由于某种原因它不起作用。

回答by morpheus05