简体   繁体   English

src文件夹未添加到Eclipse中的Java Classpath

[英]src folder not added to Java Classpath in eclipse

I have created a maven project and converted it into TESTNG. 我创建了一个maven项目并将其转换为TESTNG。 Now I am trying to create a package under src folder.However no package is getting created rather only a normal folder is created. 现在我试图在src文件夹下创建一个包,但是没有创建任何包,只创建了一个普通文件夹。

It gives me the above error saying src folder not added to Java classpath. 它给了我上面的错误,说src文件夹未添加到Java类路径中。

Here is my .classpath file. 这是我的.classpath文件。 how should I add src to it. 我应该如何添加src。

    <?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_73"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

Looks like the Source is not set in the BuildPath of your project. 看起来您的项目的BuildPath中没有设置Source。 Go into Project-> Properties->Java Build Path-> Source Tab-> select all the source folders(src) Build it and you should be good. 进入“项目”->“属性”->“ Java构建路径”->“源”选项卡->选择所有源文件夹(src)对其进行构建,您应该会很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM