Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Process fork failed" while running ant run command

Tags:

java

ant

I am getting "Process fork failed" error while executing ant run command in Ant. Please find below build.xml file.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE project []>

<project name="Learning TestNG" default="usage" basedir=".">  

<!-- ========== Initialize Properties =================================== -->
<property environment="env"/>

<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="G:\Jars_libs"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="ng.result" value="G:\Java_Workspace\TestNG_XSLT_reports"/>

<!--target name="start-selenium-server">
    <java jar="${ws.home}/lib/selenium-server.jar"/>
</target-->

<target name="setClassPath" unless="test.classpath">
    <path id="classpath_jars">
        <fileset dir="${ws.jars}" includes="*.jar"/>
    </path>
    <pathconvert pathsep=":" 
        property="test.classpath" 
        refid="classpath_jars"/>
</target>

<target name="init" depends="setClassPath">
    <tstamp>
        <format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
    </tstamp>
    <condition property="ANT" 
        value="${env.ANT_HOME}/bin/ant.bat" 
        else="${env.ANT_HOME}/bin/ant">
                <os family="windows" />
    </condition>
    <taskdef name="testng" classpath="${test.classpath}"
           classname="org.testng.TestNGAntTask" />

</target>

<!-- all -->
<target name="all">
</target>

<!-- clean -->
<target name="clean">
    <delete dir="${test.dest}"/>
</target>

<!-- compile -->
<target name="compile" depends="init, clean" > 
    <delete includeemptydirs="true" quiet="true">
        <fileset dir="${test.dest}" includes="**/*"/>
    </delete>
    <echo message="making directory..."/>
    <mkdir dir="${test.dest}"/>
    <echo message="classpath------: ${test.classpath}"/>
    <echo message="compiling..."/>
    <javac 
        debug="true" 
        destdir="${test.dest}" 
        srcdir="${test.src}" 
        target="1.8" 
        classpath="${test.classpath}">

    </javac>
  </target>

<!-- build -->
<target name="build" depends="init">
</target>

<!-- run -->
<target name="run" depends="compile">
    <testng classpath="${test.classpath}:${test.dest}" suitename="My Suite">    
        <xmlfileset dir="${ws.home}" includes="testng.xml"/>
    </testng>
    <!--
    <testng classpath="${test.classpath}:${test.dest}" groups="fast">
        <classfileset dir="${test.dest}" includes="example1/*.class"/>
    </testng>
    -->
</target>

<target name="usage">
    <echo>
        ant run will execute the test
    </echo>
</target>

<path id="test.c">
        <fileset dir="${ws.jars}" includes="*.jar"/>
</path>

  <target name="makexsltreports">
        <mkdir dir="${ws.home}/XSLT_Reports/output"/>

        <xslt in="${ng.result}/testng-results.xml" style="src/xslt/testng-results.xsl"
              out="${ws.home}/XSLT_Reports/output/index.html" classpathref="test.c" processor="SaxonLiaison">
            <param name="testNgXslt.outputDir" expression="${ws.home}/XSLT_Reports/output/"/>
            <param name="testNgXslt.showRuntimeTotals" expression="true"/>
        </xslt>
    </target>

<!-- ****************** targets not used ****************** -->

On executing ant -verbose run command I am getting below error.I request humbly kindly help me, I have googled everything but found nothing. I am stuck very badly in this and trying for last 4 days. :(

java.io.IOException: Cannot run program "C:\Program Files\Java\jre1.8.0_31\bin\java.exe": Create Process error=206, The Filename or extension is too long.

like image 731
Ahmed Siddiqui Avatar asked Mar 12 '15 17:03

Ahmed Siddiqui


1 Answers

After hours of en-devour, I am able to solve the issue. Please remove unnecessary jar files from Classpath and try. It worked for me. Cheers..:)

Regs

like image 78
Ahmed Siddiqui Avatar answered Nov 01 '22 05:11

Ahmed Siddiqui