Search code examples
javaeclipseapache-commons-net

Subnet Utils cannot be resolved to a type


I have a java code-

import org.apache.commons.net.util.*;

public class test {
    public static void main (String args[]) {
        SubnetUtils utils = new SubnetUtils("192.168.1.0/24");
        String[] allIps = utils.getInfo().getAllAddresses();
    }
}

The apache commons net jar is added to the classpath.

Still I am getting an error for SubnetUtils as it cannot be resolved to a type.

Any ideas ?


Solution

  • The issue is resolved now.

    Checked the class files inside the apache-commons-net.jar and there was no SubnetUtils present. The jar file seems to be of a very old version.

    Downloaded a latest jar and everything works fine.