Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

Thank you for any advice,

like image 258
Ya Basha Avatar asked Jun 03 '12 15:06

Ya Basha


People also ask

What are library files in Java?

Libraries in java are essentially packages that contain classes or interfaces, which generally fall under a certain category. These classes or interfaces contain methods which you may be willing to use in your program without having to rewrite the whole method again.


3 Answers

You can use the following article to understand the way.

creating a Jar file

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.

like image 178
Chathuranga Chandrasekara Avatar answered Sep 30 '22 13:09

Chathuranga Chandrasekara


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.

http://maven.apache.org/

like image 20
Ludwig Magnusson Avatar answered Sep 30 '22 13:09

Ludwig Magnusson


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

jar -cf myjarfile.jar *.java

hope this helps see also: Creating a JAR File

like image 31
baby boom Avatar answered Sep 30 '22 12:09

baby boom