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

查看:472
本文介绍了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. This is possible as Eclipse uses its own built-in compiler, instead of javac from the JDK which Apache Maven uses. 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.

此screendump中的设置标有红色框:

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

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

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