Could not find or load main class

406 views
Skip to first unread message

Ashley Simon

unread,
Sep 19, 2016, 1:56:32 AM9/19/16
to JaCoCo and EclEmma Users
Hi ,
I am doing code coverage using JaCoCo with Ant Tasks.
I am able to get the jacoco.exec and the reports.
But the reports are showing 0% code coverage and there is an error as well .
The error is "Could not find or load main class *"

The test part of build.xml is as follows :

     <target name="test">
<!-- Step 2: Wrap test execution with the JaCoCo coverage task -->
<jacoco:coverage destfile="${result.exec.file}">
<java classname="*" fork="true">
<classpath>
<pathelement location="${result.classes.dir}"/>
                                </classpath>
</java>
</jacoco:coverage>
<!-- Step 2: Wrap test execution with the JaCoCo coverage task -->
<jacoco:coverage>
<junit fork="true" forkmode="once">
<test name="CodeTest" filtertrace="true"/>
<classpath path="${result.classes.dir}"/>
</junit>
</jacoco:coverage>
</target>

I have to do coverage for more than one file which is located under ${result.classes.dir} .
The code is written using JavaScript.

Thanks ,
Ashley Simon

Marc R. Hoffmann

unread,
Sep 19, 2016, 8:25:19 AM9/19/16
to jac...@googlegroups.com
Hi,

I don't think "*" is a valid class name to launch a Java program.

I recommend to make your build running without JaCoCo first.

Also I wonder what you mean with "JavaScript". JaCoCo is a coverage tool for compiled languages (like Java) for the JVM. I don't think JaCoCo works with JavasScript.

Regards,
-marc
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/a7338110-793f-4ea2-a663-e4ae0436490d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
Marc Hoffmann
hoff...@mountainminds.com
_______________________________________________
Mountainminds GmbH & Co. KG

Nussbaumstr. 4 * 80336 Muenchen * Germany 
Phone/Fax +49-700-68664637 * 0700-MTNMINDS

Registergericht Muenchen * HRA 80201
Mountainminds Verwaltungs GmbH
Registergericht Muenchen * HRB 143183
Geschaeftsfuehrer Marc Hoffmann

Ashley Simon

unread,
Sep 20, 2016, 1:07:22 AM9/20/16
to JaCoCo and EclEmma Users
 Thanks a lot for the help,
Ashli

Ashley Simon

unread,
Sep 20, 2016, 8:10:11 AM9/20/16
to JaCoCo and EclEmma Users
Hi,
Yes, the code is written in java.My mistake !
Is there any way to have check the whole folder ?
Here, I guess the class name can take a particular class , so when giving * or the whole folder name ,It is giving error.
I tried with module..but it says <java> does not support nested module.
And there are no jar files , so I cant give any jar attribute.
Currently I wrote a code that commented the whole <java> part and gave the path for the class files in <junit> itself. So, is it necessary to give that part ?
Can you also say whether the <target name=test> is included in our build.xml for executing the test-cases in our project ?

The newly written code :

<target name="test">
  <jacoco:coverage>
<junit fork="true" forkmode="once">
   <test name="CodeTest" filtertrace="true"/>
<classpath path="${result.classes.dir}">
       <batchtest fork="yes" todir="${result.exec.file}">
<fileset dir="${result.classes.dir}">
<include name="**/*Test*.class"/>
</fileset>
    </batchtest>
               </classpath>
 </junit>
   </jacoco:coverage>
 </target>

Marc R. Hoffmann

unread,
Sep 20, 2016, 11:39:45 AM9/20/16
to jac...@googlegroups.com
Hi Ashley,

probably you should first get an idea how Ant builds work before you start adding code coverage to it.

Please understand that we cannot provide support for Ant itself. As a starting point you might work through the tutorials in their manuals:
http://ant.apache.org/manual/index.html
Regards,
-marc
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.

Ashley Simon

unread,
Sep 21, 2016, 12:16:30 AM9/21/16
to JaCoCo and EclEmma Users
Thanks,
Ashley ^_^

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages