Missed from previous commit
Adds getResource API to AgentJar to get URL of embedded agent jar
diff --git a/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java b/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java
index c7a30e2..97d370e 100644
--- a/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java
+++ b/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java
@@ -18,6 +18,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.URL;
/**
* API to access the agent JAR file as a resource.
@@ -36,6 +37,19 @@
}
/**
+ * Returns a URL pointing to the JAR file.
+ *
+ * @return URL of the JAR file
+ */
+ public static URL getResource() {
+ final URL url = AgentJar.class.getResource(RESOURCE);
+ if (url == null) {
+ throw new RuntimeException(ERRORMSG);
+ }
+ return url;
+ }
+
+ /**
* Extract the JaCoCo agent jar from the classpath and put it into a
* temporary location. This file should be deleted on exit, but may not if
* the VM is terminated