您的位置:首页 > 编程语言 > Java开发

How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?

2016-08-26 17:02 806 查看

How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?






up vote7down votefavorite
1

This error comes up in an alert box when I try saving my js file in eclipse:


Compilation unit name must end with .java, or one of the registered Java-like extensions


In the breakpoints view I see this:

/module-foo/src/main/resources/frontend/foo/foo_base.js [entry] - ___anonymous()


eclipse
share|improve this question
edited Aug 19 '14 at 14:17

asked Aug 14 '14 at 19:01

Noremac
1,77231844

add a comment |

3 Answers 3

active oldest votes

up vote22down voteaccepted
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

Hopefully putting it here will make it easier to find as I didn't find much when I was trying to resolve this before.

share|improve this answer
edited Aug 18 '14 at 14:41

answered Aug 14 '14 at 19:01

Noremac
1,77231844

I doubt a breakpoint would lead to this error. Are you sure it's not a coincidence ? Any detail ? – Denys Séguret Aug 14 '14 at 19:02
I added a breakpoint to the js file, but it did not recreate the issue. I left it for a couple days and still nothing happened. So, I'm not sure what triggers the issue. I highly doubt I had put a breakpoint in there originally. It seemed that eclipse just got in an bad state. Restarting eclipse didn't help, only removing this odd breakpoint at the start of the file. – Noremac Aug 18 '14 at 13:51
Of course, after posting the above, I started getting the error again and apparently on the breakpoint I set a few days ago (except now the breakpoint is at the top of the file, just like the other one was). Is there anything you'd like me to try while I am getting the issue? – Noremac Aug 18 '14 at 20:37
There are so many cases of one of the many Eclipse caches getting corrupted that it's probably impossible to determine which Eclipse bug you encountered. In my opinion you should probably delete this QA as hopeless. – Denys Séguret Aug 19 '14 at 6:41
It's meant for as an answer, how to fix this issue. I wasn't expecting a full explanation, or as a bug report. This fixed it for me, and I only found it through an obscure comment. Putting it as QA makes the fix much more readily available. – Noremac Aug 19 '14 at 14:16
add a comment |





up vote3down vote
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.

share|improve this answer
answered Feb 27 '15 at 19:56

ivandov
809

add a comment |
up vote0down vote
I had an breakpoint set in the file.By Removing the breakpoint resolved the problem.

share|improve this answer
answered Dec 16 '15 at 7:32

user5650798

add a comment |

draft saved
draft discarded
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐