我在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
引用了它。
答案 0 :(得分:0)
外部文件具有不同的包结构,因此无法编译。尝试在项目中导入该类并首先修复编译问题,然后尝试在您的应用程序中使用。它应该工作。