java 创建java库文件

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

create java library file

javajarjdeveloperoracle-adf

提问by Ya Basha

I'm using number of java files as common in different ADF projects, I want to archive them in jar file so I can import this archive file from any new project to use the java libraries in the project, I tried create it in jdeveloper but no luck.

我在不同的 ADF 项目中使用了许多常见的 java 文件,我想将它们存档在 jar 文件中,以便我可以从任何新项目导入这个存档文件以使用项目中的 java 库,我尝试在 jdeveloper 中创建它,但是没有运气。

Thank you for any advice,

谢谢你的任何建议,

回答by Chathuranga Chandrasekara

You can use the following article to understand the way.

你可以通过下面的文章来了解方法。

creating a Jar file

创建 Jar 文件

jar cf jar-file input-file(s)

But still you can zip a file using windows zip utility or winzip and rename it as a jar file. It is not official but it works.

但是您仍然可以使用 windows zip 实用程序或 winzip 压缩文件并将其重命名为 jar 文件。这不是官方的,但它有效。

回答by Ludwig Magnusson

No matter how big or small you project is, the best answer to this question IMHO is a build tool. I would recommend maven, it is a great tool. It will take some time to get into and it will probably slow down your pace at first but the rewards of knowing how to use a tool like that are very big.

无论您的项目有多大,恕我直言,这个问题的最佳答案是构建工具。我会推荐 maven,它是一个很棒的工具。入门需要一些时间,一开始可能会减慢您的步伐,但是知道如何使用此类工具的回报非常大。

http://maven.apache.org/

http://maven.apache.org/

回答by baby boom

from your terminal - go to the directory where you have the files you want to jar and type the command

从您的终端 - 转到您要 jar 的文件所在的目录并键入命令

jar -cf myjarfile.jar *.java

jar -cf myjarfile.jar *.java

hope this helps see also: Creating a JAR File

希望这也有助于参见: Creating a JAR File

回答by Shay Shmeltzer

Assuming that the files that you want to reuse are related to ADF you should read about using ADF Libraries to increase reusability. See: http://docs.oracle.com/cd/E16162_01/web.1112/e16182/reusing_components.htm#BEIGHHCG

假设您要重用的文件与 ADF 相关,您应该阅读有关使用 ADF 库来提高可重用性的信息。请参阅:http: //docs.oracle.com/cd/E16162_01/web.1112/e16182/reusing_components.htm#BEIGHHCG