【问题标题】:Eclipse Java Class "cannot be resolved to a type" error messageEclipse Java 类“无法解析为类型”错误消息
【发布时间】:2021-01-26 03:58:40
【问题描述】:

我在 Eclipse 中收到“无法解析为类型”的错误(确切的错误消息:“ApplicationContext 无法解析为 MainApp.java /HelloSpring/src/com/tutorialspoint 第 8 行 Java 问题的类型” )。我配置了类似于所有这些文章所说的构建路径:

Eclipse Build Path Not Available

Attach the Source in Eclipse of a Jar

How to use referenced classed in libraries in Eclipse

所附图片显示了我的简单文件结构,其中“引用库”展开以显示应该解析“ApplicationContext”类的 JAR 文件。

Screenshot of Eclipse with error message and file structure expanded

我觉得我缺少一个比经验丰富的 Java/Eclipse 程序员容易看到的简单修复。感谢您提供的任何帮助/建议/文章/建议!

Tutorial Reference

Spring.io

【问题讨论】:

    标签: java eclipse import jar package


    【解决方案1】:

    让 Spring Boot 及其支持的构建工具之一(Maven 或 Gradle)为您设置项目。这样更快更简单。
    您的项目可能存在类路径问题,Spring Boot 会为您处理。

    在我的德语博客中,我有这个分步指南:
    https://agile-coding.blogspot.com/2020/09/microservices-mit-spring-boot-erstellen.html

    【讨论】:

    • 谢谢 Elmar Brauch。我使用谷歌翻译阅读了你的英文网站教程:link。很棒的教程!使用 Spring Boot 似乎效果更好!我现在会这样做。谢谢!我发现这篇关于我的问题的 StackOverflow 文章:link。我尝试了他们的建议,但无法解决我的错误。如果我弄清楚了,我会发布。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-31
    • 2015-11-13
    • 1970-01-01
    相关资源
    最近更新 更多