Eclipse:无法生成序列版本ID

Tit*_*ity 17 java eclipse

我有Eclipse 3.6(Helios)的问题:

任何时候我想为serialVersionUID扩展serializable类的类生成一个串行版本ID(),我收到以下消息:

发生以下错误:找不到类文件.确保文件可编译.

我究竟做错了什么 ?

谢谢.

Po *_*hou 12

就我而言,我通过以下方式解决了这个问题:

右键单击项目"构建路径" - >"配置构建路径" - >"源"选项卡,删除标记为"缺失"的路径.


Mar*_*han 5

有时一个工具(例如AspectJ - AJDT或其他工具)删除了项目的Java性质,并且它没有编译,因为它没有在编辑器上显示任何错误.

检查您是否有包含两个条目的.project文件: org.eclipse.jdt.core.javabuilderorg.eclipse.jdt.core.javanature

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>Myproject</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
            <!-- This one is required -->
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>

        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>

            <!-- This one is required too -->
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    </natures>
</projectDescription>
Run Code Online (Sandbox Code Playgroud)