Java:未解决的编译问题 [英] Java: Unresolved compilation problem

查看:31
本文介绍了Java:未解决的编译问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java.lang.Error:未解决的编译问题"的可能原因是什么?

What are the possible causes of a "java.lang.Error: Unresolved compilation problem"?

附加信息:

在从现有 JAR 之上的构建复制一组更新的 JAR 文件并重新启动应用程序后,我看到了这一点.JAR 是使用 Maven 构建过程构建的.

I have seen this after copying a set of updated JAR files from a build on top of the existing JARs and restarting the application. The JARs are built using a Maven build process.

如果接口发生变化,我希望看到 LinkageErrors 或 ClassNotFound 错误.上述错误暗示了一些较低级别的问题.

I would expect to see LinkageErrors or ClassNotFound errors if interfaces changed. The above error hints at some lower level problem.

干净的重建和重新部署解决了这个问题.此错误是否表示 JAR 已损坏?

A clean rebuild and redeployment fixed the problem. Could this error indicate a corrupted JAR?

推荐答案

(重写 2015-07-28)

(rewritten 2015-07-28)

当编译有错误的代码时,Eclipse 的默认行为是生成字节码,抛出您看到的异常,允许程序运行.这是可能的,因为 Eclipse 使用它自己的内置编译器,而不是 Apache Maven 使用的 JDK 中的 javac,并且由于错误而导致编译完全失败.如果您在使用命令行 mvn 命令处理的 Maven 项目上使用 Eclipse,则可能会发生这种情况.

The default behavior of Eclipse when compiling code with errors in it, is to generate byte code throwing the exception you see, allowing the program to be run. This is possible as Eclipse uses its own built-in compiler, instead of javac from the JDK which Apache Maven uses, and which fails the compilation completely for errors. If you use Eclipse on a Maven project which you are also working with using the command line mvn command, this may happen.

解决方法是修复错误并重新编译,然后再次运行.

The cure is to fix the errors and recompile, before running again.

此屏幕转储中的设置标有红色框:

The setting is marked with a red box in this screendump:

这篇关于Java:未解决的编译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆