diff --git a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
index 659f7ed9a47..4a2ad34b3db 100644
--- a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
+++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
@@ -31,6 +31,8 @@ import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
 import jdk.test.lib.Asserts;
+import jdk.test.lib.ByteCodeLoader;
+import jdk.test.lib.compiler.InMemoryJavaCompiler;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.whitebox.WhiteBox;
@@ -91,9 +93,6 @@ public class TestMetaSpaceLog {
   }
 
   private static void testMetaSpaceUpdate() throws Exception {
-    // Propagate test.src for the jar file.
-    String testSrc= "-Dtest.src=" + System.getProperty("test.src", ".");
-
     ProcessBuilder pb =
       ProcessTools.createTestJvm(
           "-Xlog:gc*",
@@ -102,7 +101,7 @@ public class TestMetaSpaceLog {
           "-XX:+WhiteBoxAPI",
           "-Xmx1000M",
           "-Xms1000M",
-          testSrc, StressMetaSpace.class.getName());
+          StressMetaSpace.class.getName());
 
     OutputAnalyzer output = null;
     try {
@@ -117,29 +116,20 @@ public class TestMetaSpaceLog {
   }
 
   static class StressMetaSpace {
-    private static URL[] urls = new URL[1];
-
-    static {
-      try {
-        File jarFile = new File(System.getProperty("test.src") + "/testcases.jar");
-        urls[0] = jarFile.toURI().toURL();
-      } catch (Exception e) {
-        e.printStackTrace();
-      }
-    }
 
     public static void main(String args[]) {
-      WhiteBox wb = WhiteBox.getWhiteBox();
-      for(int i = 0; i < 10000; i++) {
-        loadClass(wb);
-      }
-      wb.fullGC();
+      loadManyClasses();
+      WhiteBox.getWhiteBox().fullGC();
     }
 
-    public static void loadClass(WhiteBox wb) {
+    public static void loadManyClasses() {
+      String className = "Tmp";
+      String sourceCode = "public class Tmp {}";
+      byte[] byteCode = InMemoryJavaCompiler.compile(className, sourceCode);
       try {
-        URLClassLoader ucl = new URLClassLoader(urls);
-        Class.forName("case00", false, ucl);
+        for (int i = 0; i < 10000; i++) {
+          ByteCodeLoader.load(className, byteCode);
+        }
       } catch (Exception e) {
         e.printStackTrace();
       }
diff --git a/test/hotspot/jtreg/gc/logging/testcases.jar b/test/hotspot/jtreg/gc/logging/testcases.jar
deleted file mode 100644
index 5996133fe1e..00000000000
Binary files a/test/hotspot/jtreg/gc/logging/testcases.jar and /dev/null differ