Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse:java.io.FileNotFoundException:(系统找不到指定的文件)_Java_Eclipse_Testng_Filenotfoundexception_Buildpath - Fatal编程技术网

Eclipse:java.io.FileNotFoundException:(系统找不到指定的文件)

Eclipse:java.io.FileNotFoundException:(系统找不到指定的文件),java,eclipse,testng,filenotfoundexception,buildpath,Java,Eclipse,Testng,Filenotfoundexception,Buildpath,我将config添加到构建路径中的源代码列表中,但RunClass仍然抱怨无法找到该文件 它给出: java.io.FileNotFoundException: C:\Users\asdf\eclipse workspace\NG\xml.xml( 系统找不到指定的文件) 为什么您认为构建路径与您得到的错误有关?是什么代码导致了这个错误?@JBNizet我指的是这个类似的帖子@ArvindKumarAvinash这个xml文件肯定在项目中,只是不在默认的src文件夹中。它是config->pkg

我将config添加到构建路径中的源代码列表中,但RunClass仍然抱怨无法找到该文件

它给出:

java.io.FileNotFoundException: C:\Users\asdf\eclipse workspace\NG\xml.xml( 系统找不到指定的文件)


为什么您认为构建路径与您得到的错误有关?是什么代码导致了这个错误?@JBNizet我指的是这个类似的帖子@ArvindKumarAvinash这个xml文件肯定在项目中,只是不在默认的src文件夹中。它是config->pkg->[RunClass,xml.xml]你链接到的问题和你的一样,不包含任何代码。为了能够解释代码为何会以这种方式运行,我们需要查看该代码。发布代码。@JBNizet已添加到我的原始帖子中
public class RunTests {
public static void main(String[] args) {
    TestNG testNG = new TestNG();
    List<String> suites = Lists.newArrayList();         

    File xml = new File("xml.xml");
    suites.add(xml.getAbsolutePath());

    testNG.setTestSuites(suites);
    testNG.run();   
}
}  
ProjectName
src

config
     pkg
       RunClass
       file.xml