15

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()    
0

5 Answers 5

40

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.

5
  • I doubt a breakpoint would lead to this error. Are you sure it's not a coincidence ? Any detail ? Aug 14, 2014 at 19:02
  • 1
    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, 2014 at 13:51
  • 1
    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, 2014 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. Aug 19, 2014 at 6:41
  • 1
    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, 2014 at 14:16
6

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.

3

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.

Go to:

Eclipse Debug perspective -> Breakpoints

view and remove the breakpoint from the .js file.

Fixed: You can now save the .js file without the error.

0

I had an breakpoint set in the file.By Removing the breakpoint resolved the problem.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.