Search code examples
javaimportapache-commonsfifonetbeans-12

How to install/use apache commons collection 4.4


This is my first time using stackoverflow.

Anyway, I am trying to use the apache commons collections 4.4 that I've downloaded here https://commons.apache.org/proper/commons-collections/download_collections.cgi

This is the code that I am trying to run for you reference

import java.util.Queue;
import org.apache.commons.collections4.queue.CircularFifoQueue;

I am having trouble with my code as I need CircularFifoQueue to run my program. I'm using netbeans ide as of the moment and I would appreciate if you guys could share a solution that does not involve switching ide. Thank you!


Solution

  • If your NetBeans project is Ant based you will need to add the jar you have downloaded as a Library. In your project there is a Libraries folder that you can right-click and select Add Library.

    If you are using Maven, you should add the dependency to your pom.xml file following Maven practices. https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

    If you are using Gradle (recommended) you should add a dependency using Gradle practices to the build.gradle file. https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html#header