eclipse 如何修复“编译单元名称必须以 .java 或已注册的类 Java 扩展名之一结尾”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25315707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I fix "Compilation unit name must end with .java, or one of the registered Java-like extensions"?
提问by Noremac
This error comes up in an alert box when I try saving my js file in eclipse:
当我尝试在 Eclipse 中保存我的 js 文件时,此错误出现在警告框中:
Compilation unit name must end with .java, or one of the registered Java-like extensions
编译单元名称必须以 .java 或已注册的类 Java 扩展名之一结尾
In the breakpoints view I see this:
在断点视图中,我看到了这一点:
/module-foo/src/main/resources/frontend/foo/foo_base.js [entry] - ___anonymous()
回答by Noremac
I had an errant breakpoint set in the file. Removing the breakpoint resolved the problem.
我在文件中设置了一个错误的断点。删除断点解决了问题。
The answer comes from a comment in another post, but was a bit obscure in the comments of a lower ranked answer here: JavaScript editor within Eclipse
答案来自另一篇文章中的评论,但在此处排名较低的答案的评论中有点晦涩:Eclipse 中的 JavaScript 编辑器
Hopefully putting it here will make it easier to find as I didn't find much when I was trying to resolve this before.
希望把它放在这里会更容易找到,因为我之前尝试解决这个问题时没有找到太多。
回答by ivandov
I also fixed this by removing breakpoints. The interesting thing was, I wasn't able to remove the breakpoint by double clicking on it as you normally would.
我还通过删除断点解决了这个问题。有趣的是,我无法像往常一样通过双击来删除断点。
I had to go into the Breakpoint View and right click and remove the breakpoint from this file. Directly afterwards, I tried to save again, and it was the first time the task completed.
我必须进入断点视图并右键单击并从此文件中删除断点。紧接着,我再次尝试保存,这是第一次完成任务。
回答by Christophe Roussy
I came here for help and it was indeed due to a breakpoint in a javascript.js file (JSDT related bug ?). I had the error popup each time I saved in the .js file.
我来这里寻求帮助,这确实是由于javascript.js 文件中的断点(与 JSDT 相关的错误?)。每次保存在 .js 文件中时,都会弹出错误消息。
Go to:
去:
Eclipse Debug perspective -> Breakpoints
Eclipse 调试透视图 -> 断点
view and remove the breakpoint from the .js file.
查看并从 .js 文件中删除断点。
Fixed: You can now save the .js file without the error.
已修复:您现在可以保存 .js 文件而不会出现错误。
回答by Britto .t. prince
I was able to get over it by removing all breakPoints.
我能够通过删除所有断点来克服它。
In Eclipse
在日食中
Run->Remove all breakpoints
运行->删除所有断点
Now you will be able to save it.
现在您将能够保存它。
回答by Britto .t. prince
I had an breakpoint set in the file.By Removing the breakpoint resolved the problem.
我在文件中设置了一个断点。通过删除断点解决了问题。