javaeclipsejgrapht

Trouble importing classes from JAR in Eclipse


I am using Eclipse for Java. I'm trying to use JGraphT and I've added the relevant JARs to the build path. Yet, I'm still not able to import any classes from JGraphT.

Screenshot

I added the JARs by clicking on 'Configure Build path'-> 'Libraries' -> 'Add external JARs'. Yet, when I try to import classes from that package, I get an error saying 'The package org.jgrapht is not accessible' (see attached screenshot).

Thanks for your help.


Solution

  • module-info.java

    ADD requires org.jgrapht.core;

    module xxx-your-module-name {
        requires org.jgrapht.core;
    }