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    
        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.

        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.

        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.

        answered Dec 16 '15 at 7:32    
    
        user5650798

 
 
   
add a comment |                      
draft saved
draft discarded
 

How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?的更多相关文章

  1. this compilation unit is not on the build of a java project

    this compilation unit is not on the build of a java project java里输入代码就出这个提示,无法写代码了. 找到觉得路径打开文件编辑就好了, ...

  2. this compilation unit is not on the build path of a java project

    在eclipse中新建maven project后,会自动生成main\test目录结构,新建一个测试类,然后编辑类文件时,总是提示错误:this compilation unit is not on ...

  3. This compilation unit is not on the build path SVN

    This compilation unit is not on the build path of a Java project 解决办法​ 把项目导入STS(基于Eclipse)时,项目出现问题, ...

  4. This compilation unit is not on the build path of java project (此编译单元不在java项目的生成路径上)

    This compilation unit is not on the build path of a Java project 解决办法​ 索发现,大致是因为项目文件缺失. 解决办法:找到项目根目录 ...

  5. ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-553: character set name is not recognized

    首先,确认字符集是否修改的不彻底.SELECT DISTINCT (NLS_CHARSET_NAME(CHARSETID)) CHARACTERSET,DECODE(TYPE#, 1, DECODE( ...

  6. Myeclipse 保存jsp异常Save FailedCompilation unit name must end with .java, or one of the registered Java-like extensions

    如图 解决方法:去掉jsp页面的调试断点

  7. Java Unit Testing - JUnit & TestNG

    转自https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaUnitTesting.html yet another insignifican ...

  8. [tip:,x86/urgent] x86: Fix early boot crash on gcc-10, third try

    [tip:,x86/urgent] x86: Fix early boot crash on gcc-10, third try   https://lore.kernel.org/patchwork ...

  9. Maven进行install的时候报错,COMPILATION ERROR : Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project cmu: There are test failures.

    maven进行install的时候,test类里面报错: COMPILATION ERROR : [INFO] -------------------------------------------- ...

随机推荐

  1. jQuery源码-dom操作之jQuery.fn.text

    写在前面 jQuery.fn.text在jQuery是个使用频率比较高的接口,它的作用无非是设置/获取dom节点的内容文本,下文会通过几个简单的例子来说明.text()接口的使用,以及最后会对源码进行 ...

  2. 欧几里得证明$\sqrt{2}$是无理数

    选自<费马大定理:一个困惑了世间智者358年的谜>,有少许改动. 原译者:薛密 \(\sqrt{2}\)是无理数,即不能写成一个分数.欧几里得以反证法证明此结论.第一步是假定相反的事实是真 ...

  3. firefox浏览器不能使用window.close的解决方案

    javascript中window.close()函数用来关闭窗体,而且IE.google.firefox浏览均支持,但由于firefox浏览器dom.allow_scripts_to_close_w ...

  4. 关于COOKIE学习的一二

    index.php <?php setcookie("name","dalisng",time()+3600); setcookie("addr ...

  5. 微信公众平台中添加qq在线聊天代码

    微信公众平台是个不错的媒体,可以和你的小伙伴们即时交流,但你的小伙伴们是用手机上的微信,打字自然就慢了:有人说用微信网页版,那个也不习惯,再说也不一定所有人都知道网页版微信.(2014.01.22更新 ...

  6. 1455.Solitaire(bfs状态混摇)

    Solitaire Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  7. Visual Studio 各种版本的快捷键总结

    下列快捷组合键可在工具和文档窗口中用于进行移动.关闭或导航. 命令名 快捷键 说明 视图.全屏 SHIFT + ALT + ENTER 在打开和关闭之间切换“全屏”模式. 视图.向后定位 CTRL + ...

  8. xcode7 The operation couldn't be completed.

    问题描述:当运行Xcode6时,编译代码成功,但是登陆模拟器失败,显示错误:The Operation couldn't be completed.(LaunchServicesError error ...

  9. vue.js 简单入门

    转载自:http://blog.csdn.net/violetjack0808/article/details/51451672 <!DOCTYPE html> <html lang ...

  10. java中的方法重载与重写以及方法修饰符

    1. 方法重载Overloading , 是在一个类中,有多个方法,这些方法的名字相同,但是具有不同的参数列表,和返回值 重载的时候,方法名要一样,但是参数类型和参数个数不一样,返回值类型可以相同,也 ...