错误!第一个参数的非静态Java函数'取代'不是一个有效的对象引用 [英] Error! The first argument to the non-static Java function 'replace' is not a valid object reference

查看:799
本文介绍了错误!第一个参数的非静态Java函数'取代'不是一个有效的对象引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让蚂蚁在Eclipse中创建一个JUnit测试的HTML报告,但之后我创建Ant构建我收到以下错误,当我运行它:

  [junitreport]处理C:\\ Documents和Settings \\管理员\\工作区\\首页\\的JUnit \\测试 -  TestSuites.xml到C:\\ DOCUME〜1 \\ ADMINI〜1 \\ LOCALS〜 1 \\ TEMP \\ null785926900
[junitreport]加载样式表jar:file:/C:/ANT/apache-ant-1.8.3/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport]:错误!第一个参数的非静态Java函数'取代'不是一个有效的对象引用。
[junitreport]:错误!无法转换数据类型无效到参考。
[junitreport]:致命错误!无法编译样式表
[junitreport]未能处理C:\\ Documents和Settings \\管理员\\工作区\\首页\\的JUnit \\测试 - TestSuites.xml

什么我需要做的,解决这个问题?

下面是我在build.xml的部分我试图运行:

 <目标名称=家>
    < MKDIR DIR =$ {} junit.output.dir/>
    < JUnit的叉=YESprintsummary =withOutAndErr>
        <格式化类型=XML/>
        <试验NAME =家todir =$ {} junit.output.dir/>
        <类路径REFID =Home.classpath/>
    < / JUnit的>
< /目标与GT;
<目标名称=junitreport>
    < junitreport todir =$ {} junit.output.dir>
        <文件集DIR =$ {} junit.output.dir>
            <包括姓名=TEST - * XML。/>
        < /文件集>
        <报告格式=帧todir =$ {} junit.output.dir/>
    < / junitreport>
< /目标与GT;


解决方案

当我得到这个错误,我不得不右键点击在Eclipse我的build.xml文件,选择运行方式Ant构建...选项(第3一个在菜单中),然后单击JRE选项卡和同一个JRE的工作空间运行选项中选择,然后继续运行脚本。出于某种原因,这个固定的问题。老实说,我不知道为什么。

I am trying to get ANT to create an HTML report of a JUNIT test in Eclipse but after I created the ANT build I get the following errors when I run it:

[junitreport] Processing C:\Documents and Settings\Administrator\workspace\Home\junit\TESTS-TestSuites.xml to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\null785926900
[junitreport] Loading stylesheet jar:file:/C:/ANT/apache-ant-1.8.3/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process C:\Documents and Settings\Administrator\workspace\Home\junit\TESTS-TestSuites.xml

What do I need to do to fix this?

Here are the sections of my Build.xml I am trying to run:

<target name="Home">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <test name="Home" todir="${junit.output.dir}"/>
        <classpath refid="Home.classpath"/>
    </junit>
</target>
<target name="junitreport">
    <junitreport todir="${junit.output.dir}">
        <fileset dir="${junit.output.dir}">
            <include name="TEST-*.xml"/>
        </fileset>
        <report format="frames" todir="${junit.output.dir}"/>
    </junitreport>
</target>

解决方案

When I got this error I had to right click on my build.xml file in Eclipse, choose the "Run as Ant build..." option (3rd one in the menu) then click the JRE tab and select the "Run in the same JRE as the workspace" option and then proceeded to run the script. For some reason this fixed the problem. I honestly don't know why.

这篇关于错误!第一个参数的非静态Java函数'取代'不是一个有效的对象引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆