简体   繁体   English

Subnet Utils无法解析为某种类型

[英]Subnet Utils cannot be resolved to a type

I have a java code- 我有一个java代码 -

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. apache commons net jar被添加到类路径中。

Still I am getting an error for SubnetUtils as it cannot be resolved to a type. 我仍然收到SubnetUtils的错误,因为它无法解析为类型。

Any ideas ? 有任何想法吗 ?

The issue is resolved now. 这个问题现在解决了。

Checked the class files inside the apache-commons-net.jar and there was no SubnetUtils present. 检查了apache-commons-net.jar中的类文件,并且没有SubnetUtils。 The jar file seems to be of a very old version. jar文件似乎是一个非常古老的版本。

Downloaded a latest jar and everything works fine. 下载了最新的jar,一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM