Java目录错误

标签 java class

我收到以下错误

javac MyCollection.java ./au/edu/uow/Collection/CollectionFactory.java:109: 
cannot access au.edu.uow.Collection.DVDAlbum
bad class file: ./au/edu/uow/Collection/DVDAlbum.java
file does not contain class au.edu.uow.Collection.DVDAlbum
Please remove or make sure it appears in the correct subdirectory of the classpath.
                    DVDAlbum dvd = new DVDAlbum(tempTitle,tempGenre, tempDirector, tempPlot);

来自以下代码

package au.edu.uow.Collection;

import java.util.ArrayList;
import java.io.*;

public class CollectionFactory{
        DVDAlbum dvd = new DVDAlbum(tempTitle,tempGenre, tempDirector, tempPlot);
}

这是 DVDAlbum 实现

import au.edu.uow.Collection.Album;

public class DVDAlbum implements Album{

    private String Title;
    private String Genre;
    private String Director;
    private String Plot;
    private String MediaType;

    public DVDAlbum(String TempTitle, String TempGenre, String TempDirector, String TempPlot){
        Title = TempTitle;
        Genre = TempGenre;
        Director = TempDirector;
        Plot = TempPlot;
    }
    String getMediaType(){
        return MediaType;
    }
    String getTitle(){
        return Title;
    }
    String getGenre(){
        return Genre;
    }
}

任何帮助将不胜感激

最佳答案

您的DVDAlbum似乎没有任何包声明。添加:

package au.edu.uow.Collection;

关于Java目录错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12122077/

相关文章:

c++ - c++定义前通过调用类初始化对应的类

php - 使用 php 调整图像大小

java - 如何在java中缩放图像上绘图?

Java 8 Lambda 表达式——方法重载疑惑

java - 如何将 spring 2 中的 AuthenticationProcessingFilterEntryPoint 转换为 spring 4

Java:类型转换为泛型

Python 类 __init__ 布局?

如果对象类不包含值,jquery 隐藏对象

java - jaxb2-maven-plugin Jakarta 和 java 11

java - 为什么将布局设置为 BorderLayout 意味着永远不会调用 paintComponent