无法访问JAR中的类

时间:2018-03-26 06:38:00

标签: java jar enums

我已经从代码创建了一个java文件,并将其绑定在项目的JAR文件中。现在我试图从我项目的另一个模块中使用这个JAR。除了我生成的类之外,所有类都是可见的。 生成的JAVA类是ENUM类型,似乎非常好。可能的原因是什么?

jar tf的输出是:

META-INF/
META-INF/MANIFEST.MF
com/
com/
com/processing/
com/processing/
com/processing/commonutils/
com/processing/commonutils/enumGenerator/
com/processing/commonutils/enumGenerator/csvUtil/
com/processing/commonutils/enumGenerator/csvUtil/CsvHeaderConstants.class
com/processing/commonutils/enumGenerator/csvUtil/CsvReader.class
com/processing/commonutils/enumGenerator/csvUtil/CsvToEnumConverter.class
com/processing/commonutils/enumGenerator/csvUtil/DataTypeEnum.class
com/processing/commonutils/enumGenerator/main/
com/processing/commonutils/enumGenerator/main/ErrorEnumGeneratorMain.class
Error Data1.csv
Error Data2.csv
com/processing/commonutils/enumGenerator/Data1ErrorEnum.class
com/processing/commonutils/enumGenerator/Data2ErrorEnum.class

我无法访问Data1ErrorEnum或Data2ErrorEnum类。休息所有课程都可见。 Data1ErrorEnum类看起来像:

package com.processing.commonutils.enumGenerator;

public enum Data1ErrorEnum {

    DIE_1 ( "Data integrity error","FATAL" );

    private String errorType ;
    public String errorType() {
        return errorType;
    } 

    private String severity ;
    public String severity() {
        return severity;
    } 

    private Data1ErrorEnum  (String errorType,String severity)
    {
        this.errorType = errorType;
        this.severity = severity;
    }
}

我尝试访问此类的类如下所示:

package com.processing.commonutils.error;

import com.processing.commonutils.enumGenerator.*;

public class SystemException extends Exception {

    Data1ErrorEnum data1ErrorEnum ;

   }

0 个答案:

没有答案