I've instrumented an Applet for coverage and have
opened up security in my JRE's java.policy file to be wide
open.
grant {
// Allow everything for now
permission java.security.AllPermission;
};
I've also placed emma.jar in the jre's lib/ext folder.
When I run the applet in my browser I see the
following java console messages.
Initializing JVM for plug-in
JVM loading complete
EMMA: collecting runtime coverage data ...
Debug mode: false
When the browser shuts down and the jre/console goes
away I cannot locate the coverage.ec file.
I also tried adding
-Demma.coverage.out.file=c:\temp\peterc.ec
-Demma.coverage.out.merge=true
to the JRE's Java Runtime parameters.
If I create/instument a simple applet and run in the
appletviewer then I do indeed get coverage data. When
I run in the context of an IE browser using the latest jre
plugin-in then I do not get coverage data.
the only Emma output I see in the java plugin console is
EMMA: collecting runtime coverage data ...
I don't see any exceptions in the console or in
the .plugin* logs or trace files.
If I JAD the class file in the jars that get downloaded
into my .jpi_cache/jar/1.0 I see the
import com.vladium.emma.rt.RT;
so I can tell these were instrumented classes.
I have made the following observations.
1.) Since I've placed the emma.jar file in the jre's lib/ext
folder one would expect the following java.policy entry
to work but it doesn't
grant codeBase "file:${java.home}/lib/ext/*" {
permission java.security.AllPermission;
};
However if you put the following (looser) entry in the
java.policy file then Emma code gets called and you
don't get the class not found errors. Also the
message EMMA: collecting runtime coverage data ...
shows up in the console instead of the java.lang.Error:
packaging failure: closure resource not found messages.
grant {
permission java.security.AllPermission;
};
2.) Shutdown hooks in other apps do work in the
context of a browser and JRE plugin. e.g.The gpl version
of JCoverage does.
Attached is a zip file with a simple little Applet, html,
build.xml combination that easily reproduces.
zip containing code and instructions to reproduce problem