简体   繁体   English

无法从同一 package 中的另一个 class 导入枚举

[英]Unable to import an enum from another class in the same package

I have aa class QueueType:我有一个 class QueueType:

package mypack;

public enum QueueType {
    SMTP, PUT, POST, ISF
}

I am trying to import this into another class in the same package but I get an error saying "can't find symbol QueueType".我正在尝试将其导入到同一个 package 中的另一个 class 中,但我收到一条错误消息,提示“找不到符号 QueueType”。 What am I doing wrong?我究竟做错了什么?

package mypack;

public class RawAsupFile {

    private QueueType queueType;
.
.
.

If your files are in the same folder and you want to compile everything together then you can use with option javac *.java from folder/package location如果您的文件在同一个文件夹中并且您想将所有内容一起编译,那么您可以使用来自文件夹/包位置的选项javac *.java

In case if you want to compile each file individually then you can try with the command javac -cp <path location> filename.java .如果您想单独编译每个文件,则可以尝试使用命令javac -cp <path location> filename.java Example javac -cp D:\mypack\* RawAsupFile.java in Windows示例javac -cp D:\mypack\* RawAsupFile.java在 Windows

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

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