FreeKB - Java Programming Use classes in a JAR
Java Programming - Use classes in a JAR

A JAR (Java Archive) is a file that contains a collection of classes. As an example, let's say sample.jar file has the following. This means that sample.jar has two classes. One class is com/sample/main/People (or com.sample.main.People) and the other class is com/sample/main/Places (or com.sample.main.Places).



Apps can be configured to use one or more of the classes in the JAR. For an app to be able to use a class in the JAR, the app needs to be able to access the JAR. There are 3 ways an app can access the JAR.

  • Place the JAR file in the applications WEB-INF/lib folder
  • Place the JAR file in the application servers classpath
  • Place the JAR in a shared library

Each of these options are described in more depth in this article.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 485a9 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |