使用eclipse无法获取外部类文件夹(Java)

时间:2014-10-29 15:19:55

标签: java eclipse class

我在Mac上使用Eclipse。我想写一个创建条形图的方法。为此,我需要使用已下载并添加为外部类文件夹的Bar.java类。当我在我的方法中引用该类时,它无法识别。我过去曾遇到过其他课程的麻烦。

这是我收到的错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Bar cannot be resolved to a type
    Bar cannot be resolved to a type

    at TaxChart.main(TaxChart.java:5)

Bar.java位于/Desktop/class/的文件夹中 我使用 configure build path add external class folder 引用了它。

1 个答案:

答案 0 :(得分:0)

外部文件具有不同的包结构,因此无法编译。尝试在项目中导入该类并首先修复编译问题,然后尝试在您的应用程序中使用。它应该工作。