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

时间:2022-09-14 11:22:24

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

How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?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    
How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?
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    
How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?
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 |                      
How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?
         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    
How can I fix “Compilation unit name must end with .java, or one of the registered Java-like extensions”?
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. nth-of-type在选择class的时候需要注意的一个小问题

    查了下w3和MDN的手册,没发现有这个说明,写篇随笔记下. 1..class:nth-of-type(n)在选择class的时候,如果在class前面插入x个同类型标签,n需要加上x <!DOC ...

  2. 【报错】java&period;lang&period;RuntimeException&colon; Invalid action class configuration that references an unknown class named &lbrack;xxxAction&rsqb;

    java.lang.RuntimeException: Invalid action class configuration that references an unknown class name ...

  3. 发现大量的TIME&lowbar;WAIT解决办法 -- 修改内核参数

    今天早上一上班,有同事就反映公司好几个网站都打不开,登陆数据库 服务器(windows),发现很卡,于是重启了下服务器,进入系统后,没过一会问题依旧,查看了下系统进程,发现mysql占用率达到99%, ...

  4. EFCore数据库迁移命令整理

    前言  因为现在用.net core 开发新项目,过程中需要经常涉及到数据命令的迁移,今天分别整EFCore 的两种迁移数据库的方式 1 程序包管理器控制台 , Package Manager Con ...

  5. 如何在Ubuntu 18&period;04中安装VMware Workstation Player

    参考链接 如何在Ubuntu 18.04中安装VMware Workstation Player https://www.sysgeek.cn/ubuntu-18-04-install-vmware- ...

  6. C语言fprintf&comma; fwrite&comma; fscanf&comma; fread混用问题

    int main(int argc, const char * argv[]) { // insert code here... FILE * fp = fopen("test.txt&qu ...

  7. oracle中sequence(自增序号)的用法

    转载:https://www.cnblogs.com/liuzy2014/p/5794928.html 在oracle中sequence就是序号,每次取的时候它会自动增加.sequence与表没有关系 ...

  8. Python学习笔记系列——读写文件以及敏感词过滤器的实现

    一.读文件 #打开文件,传入文件名和标识符,r代表读 f= open('\\Users\ZC\Desktop\zc.txt','r') #调用read方法一次性读取文件的全部内容,存入内存,用str对 ...

  9. Hbase的基本认识

    1.使用场景:实时查询交互 说说概念性的东西,方便今后更加深入的理解. HBase是Apache Hadoop中的一个子项目,Hbase依托于Hadoop的HDFS作为最基本存储基础单元,通过使用ha ...

  10. lintcode101 删除排序数组中的重复数字 II

    删除排序数组中的重复数字 II   跟进“删除重复数字”: 如果可以允许出现两次重复将如何处理? 在:lintcode100删除排序数组中的重复数字 的基础上进行改进. class Solution ...