Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do you put the .jar file for an external library in java [closed]

This is probably a pretty stupid question. I just learned how to use external libraries in java by adding the .jar file to the classpath and whatnot, but where exactly do you keep the .jar file? In a video tutorial about adding .jar files to the classpath, the programmer just kept the .jar file in his downloads folder. So can you put the file anywhere? Or is there a general paradigm as to where you keep your library files that I should abide by?

like image 332
user3002473 Avatar asked Dec 28 '14 06:12

user3002473


People also ask

Where do I put the external jar file?

To include external JAR files, you can either: Copy all the JAR files of the external packages to the Java's Extension Directories (NOT applicable to JDK 9). For Windows, the JDK extension directory is located at " <JAVA_HOME>\jre\lib\ext " (e.g., " c:\Program Files\Java\jdk1.

Where do JAR files go in a Java project?

After you create a Java project, create a new folder by going to File > New > Folder. Call it “lib”. Then import the JAR file into the lib folder by going to File > Import > General > File. Alternatively, you could just copy the JAR file manually into that folder by navigating to it in your workspace.

Where is the jar file located?

A JAR file may contain a manifest file, that is located at META-INF/MANIFEST. MF . The entries in the manifest file describe how to use the JAR file. For instance, a Classpath entry can be used to specify other JAR files to load with the JAR.


1 Answers

It is better to use Dependency Management Systems like maven but if you have restriction for that then,

It's always better to put your jar file inside in your project lib folder because in migration time it will help you to keep all thing at one place.

In case of multiple project it will be better to have one centralize location on server where you put your jar files.

like image 120
atish shimpi Avatar answered Nov 14 '22 22:11

atish shimpi