简体   繁体   English

创建java库文件

[英]create java library file

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, 谢谢你的建议,

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. 但是你仍然可以使用Windows zip实用程序或winzip压缩文件并将其重命名为jar文件。 It is not official but it works. 这不是官方的,但它的确有效。

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. 我会推荐maven,这是一个很棒的工具。 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. 进入它需要一些时间,它可能会首先放慢你的速度,但知道如何使用这样的工具的回报是非常大的。

http://maven.apache.org/ http://maven.apache.org/

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 希望这也有助于了解: 创建JAR文件

Assuming that the files that you want to reuse are related to ADF you should read about using ADF Libraries to increase reusability. 假设您要重用的文件与ADF相关,您应该阅读有关使用ADF库来提高可重用性的信息。 See: http://docs.oracle.com/cd/E16162_01/web.1112/e16182/reusing_components.htm#BEIGHHCG 请参阅: http//docs.oracle.com/cd/E16162_01/web.1112/e16182/reusing_components.htm#BEIGHHCG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM