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. CF448C Painting Fence (分治递归)

    Codeforces Round #256 (Div. 2) C C. Painting Fence time limit per test 1 second memory limit per tes ...

  2. NIOS ii 流水灯

    为了做项目的前期验证工作,实验室购买了某开发板,下面是基于该板子的实现过程.作为笔记记录,供入门者参考. 1:创建一个Quartus II的工程 next选择器件,然后finish.我的器件是cycl ...

  3. R入门-第一次写了一个完整的时间序列分析代码

    纪念一下,在心心念念想从会计本科转为数据分析师快两年后,近期终于迈出了使用R的第一步,在参考他人的例子前提下,成功写了几行代码.用成本的角度来说,省去了部门去买昂贵的数据分析软件的金钱和时间,而对自己 ...

  4. firefox, chrome常见插件

    firefox: firebug flagfox adblock autoproxy foxyproxy firegestures httpfox httprequester colorzilla j ...

  5. Unix时间戳转换怎样在Excel批量修改?

    最近在操作项目的时候碰到一个Unix时间戳转换的问题."date_time":1393031347这个是什么,你知道吗?如果你对Unix时间戳了解的话一眼就看出来.但我们本着科普的 ...

  6. Bootstarp: sub_menu 自定义改变nav样式

    <style> .nav > li > a { position: relative; display: block; padding: 5px 5px; } </sty ...

  7. C#遍历文件夹及文件

    背景: 想自己实现一个网盘系统,于是需要用到遍历文件(夹)操作. C#基本知识梳理: 1.如何获取指定目录包含的文件和子目录 (1). DirectoryInfo.GetFiles():获取目录中(不 ...

  8. Java 7 Concurrency Cookbook 翻译 第一章 线程管理之二

    三.中断一个线程 一个拥有多个线程的Java程序要结束,需要满足两个条件之一:一是所有的非后台线程都执行结束了:二是某个线程执行了 System.exit() 方法.当你想要终结一个运行中的Java程 ...

  9. iOS开发——网络篇——数据安全(MD5),HTTPS,检测网络状态

    一.数据安全 1.提交用户的隐私数据一定要使用POST请求提交用户的隐私数据GET请求的所有参数都直接暴露在URL中请求的URL一般会记录在服务器的访问日志中服务器的访问日志是黑客攻击的重点对象之一 ...

  10. 简述JavaScript的运行机制

    想要理解JavaScript的运行机制,需要分别深刻理解以下几个点: · JavaScript的单线程机制 · 任务队列(同步任务和异步任务) · 事件和回调函数 · 定时器 · Event Loop ...