8181335: remove packageless CompilerUtils

Reviewed-by: alanb
diff --git a/jdk/test/java/io/FilePermission/ReadFileOnPath.java b/jdk/test/java/io/FilePermission/ReadFileOnPath.java
index 05ea1a1..b106b7b 100644
--- a/jdk/test/java/io/FilePermission/ReadFileOnPath.java
+++ b/jdk/test/java/io/FilePermission/ReadFileOnPath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
  */
 
 import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import java.nio.file.Files;
 import java.nio.file.Path;
diff --git a/jdk/test/java/lang/Class/forName/modules/TestDriver.java b/jdk/test/java/lang/Class/forName/modules/TestDriver.java
index 425a16f..db5323c 100644
--- a/jdk/test/java/lang/Class/forName/modules/TestDriver.java
+++ b/jdk/test/java/lang/Class/forName/modules/TestDriver.java
@@ -30,6 +30,7 @@
 import java.util.stream.Stream;
 
 import jdk.test.lib.util.FileUtils;
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeClass;
@@ -42,7 +43,8 @@
  * @summary Tests for Class.forName(Module,String)
  * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build TestDriver CompilerUtils jdk.testlibrary.ProcessTools TestMain TestLayer
+ * @build jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.ProcessTools
+ *        TestDriver TestMain TestLayer
  * @run testng TestDriver
  */
 
diff --git a/jdk/test/java/lang/Class/getResource/ResourcesTest.java b/jdk/test/java/lang/Class/getResource/ResourcesTest.java
index 7d15576..0e03195 100644
--- a/jdk/test/java/lang/Class/getResource/ResourcesTest.java
+++ b/jdk/test/java/lang/Class/getResource/ResourcesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import java.nio.file.Paths;
 
 import static jdk.testlibrary.ProcessTools.executeTestJava;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -32,9 +33,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build ResourcesTest CompilerUtils jdk.testlibrary.*
+ * @build ResourcesTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng ResourcesTest
  * @summary Driver for basic test of Class getResource and getResourceAsStream
  */
diff --git a/jdk/test/java/lang/ClassLoader/getResource/modules/ResourcesTest.java b/jdk/test/java/lang/ClassLoader/getResource/modules/ResourcesTest.java
index 65f0d37..ddc9d71 100644
--- a/jdk/test/java/lang/ClassLoader/getResource/modules/ResourcesTest.java
+++ b/jdk/test/java/lang/ClassLoader/getResource/modules/ResourcesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 import java.nio.file.Paths;
 
 import static jdk.testlibrary.ProcessTools.executeTestJava;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -33,9 +34,9 @@
 /**
  * @test
  * @bug 8087335
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build ResourcesTest CompilerUtils jdk.testlibrary.*
+ * @build ResourcesTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng ResourcesTest
  * @summary Driver for basic test of ClassLoader getResource and getResourceAsStream
  */
diff --git a/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java
index a67555a..1389e6e 100644
--- a/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java
+++ b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build LayerAndLoadersTest CompilerUtils ModuleUtils
+ * @build LayerAndLoadersTest jdk.test.lib.compiler.CompilerUtils ModuleUtils
  * @run testng LayerAndLoadersTest
  * @summary Tests for java.lang.ModuleLayer@defineModulesWithXXX methods
  */
@@ -48,6 +48,7 @@
 import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.stream.Collectors;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/java/lang/ModuleTests/access/AccessTest.java b/jdk/test/java/lang/ModuleTests/access/AccessTest.java
index 4bd3f2b..eb600f9 100644
--- a/jdk/test/java/lang/ModuleTests/access/AccessTest.java
+++ b/jdk/test/java/lang/ModuleTests/access/AccessTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 import java.util.Arrays;
 import java.util.List;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.executeTestJava;
 
 import org.testng.annotations.BeforeTest;
@@ -34,9 +35,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build AccessTest CompilerUtils jdk.testlibrary.*
+ * @build AccessTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng AccessTest
  * @summary Driver for test that checks access to access to types in
  *          exported and non-exported packages.
diff --git a/jdk/test/java/lang/StackTraceElement/WithClassLoaderName.java b/jdk/test/java/lang/StackTraceElement/WithClassLoaderName.java
index c58e9d6..f723b97 100644
--- a/jdk/test/java/lang/StackTraceElement/WithClassLoaderName.java
+++ b/jdk/test/java/lang/StackTraceElement/WithClassLoaderName.java
@@ -25,7 +25,7 @@
  * @test
  * @bug 6479237
  * @summary Basic test StackTraceElement with class loader names
- * @library lib /lib/testlibrary
+ * @library lib /lib/testlibrary /test/lib
  * @modules jdk.compiler
  * @build m1/* WithClassLoaderName
  * @run main/othervm m1/com.app.Main
@@ -39,6 +39,8 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
+
 import com.app.Utils;
 
 public class WithClassLoaderName {
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/Base.java b/jdk/test/java/lang/System/LoggerFinder/modules/Base.java
index 62a0fa0..912d0c2 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/Base.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/Base.java
@@ -33,6 +33,7 @@
 import java.util.stream.Stream;
 
 import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import static jdk.testlibrary.ProcessTools.executeCommand;
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
index 2e41d8e..3f2437b 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
@@ -45,8 +45,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm JDKLoggerForImageTest
  */
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java
index b9c8dbe..19e10e9 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java
@@ -45,8 +45,8 @@
  *            2. clients are in named/unnamed module,
  *               patched system module, or Xbootclasspath
  *          This test DOES require existence of java.logging module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm JDKLoggerForJDKTest
  */
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java
index 2583b1a..804b1f3 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java
@@ -45,8 +45,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm LoggerInImageTest
  */
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java
index eda8b3c..ee6f62e 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java
@@ -45,8 +45,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm NamedLoggerForImageTest
  */
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java
index f6bebdc..881aaa0 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java
@@ -45,8 +45,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm NamedLoggerForJDKTest
  */
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java
index 936fe6a..9b9878d 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java
@@ -45,8 +45,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm UnnamedLoggerForImageTest
  */
 
diff --git a/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
index 2049e37..e5cf875 100644
--- a/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
@@ -45,8 +45,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary
- * @build Base CompilerUtils jdk.testlibrary.*
+ * @library /lib/testlibrary /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run main/othervm UnnamedLoggerForJDKTest
  */
 
diff --git a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java
index 773b114..5b9aca9 100644
--- a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java
+++ b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules java.base/jdk.internal.module
  *          jdk.compiler
- * @build ModuleReaderTest CompilerUtils JarUtils
+ * @build ModuleReaderTest jdk.test.lib.compiler.CompilerUtils JarUtils
  * @run testng ModuleReaderTest
  * @summary Basic tests for java.lang.module.ModuleReader
  */
@@ -53,6 +53,7 @@
 import java.util.spi.ToolProvider;
 
 import jdk.internal.module.ModulePath;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java
index da7b169..e1b2278 100644
--- a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 import java.util.List;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.executeTestJava;
 
 import org.testng.annotations.BeforeTest;
@@ -37,9 +38,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build ProxyClassAccessTest q.NP CompilerUtils jdk.testlibrary.*
+ * @build ProxyClassAccessTest q.NP jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng ProxyClassAccessTest
  * @summary Driver for testing proxy class doesn't have access to
  *          types referenced by proxy interfaces
diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java
index c420ab4..9623f91 100644
--- a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.nio.file.Paths;
 import java.util.Arrays;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.executeTestJava;
 
 import org.testng.annotations.BeforeTest;
@@ -37,9 +38,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build ProxyTest CompilerUtils jdk.testlibrary.ProcessTools
+ * @build ProxyTest jdk.testlibrary.ProcessTools
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng ProxyLayerTest
  * @summary Test proxies to implement interfaces in a layer
  */
diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyTest.java
index 2a7945b..8dd08e1 100644
--- a/jdk/test/java/lang/reflect/Proxy/ProxyTest.java
+++ b/jdk/test/java/lang/reflect/Proxy/ProxyTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 import java.util.Arrays;
 import java.util.List;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.executeTestJava;
 
 import org.testng.annotations.BeforeTest;
@@ -34,9 +35,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build ProxyTest q.U CompilerUtils jdk.testlibrary.*
+ * @build ProxyTest q.U jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng ProxyTest
  * @summary Driver for testing proxies accessing interfaces in named modules
  */
diff --git a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java
index 4a8b15f0..78256ed 100644
--- a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java
+++ b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java
@@ -30,7 +30,7 @@
  * @library ../../../../com/sun/net/httpserver
  *          /lib/testlibrary
  *          /test/lib
- * @build FileServerHandler JarUtils CompilerUtils
+ * @build FileServerHandler JarUtils jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm CloseTest
  * @summary URL-downloaded jar files can consume all available file descriptors
  */
@@ -45,6 +45,8 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
+
 import com.sun.net.httpserver.HttpContext;
 import com.sun.net.httpserver.HttpServer;
 
diff --git a/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java b/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java
index 68a2f82..30afec4 100644
--- a/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java
+++ b/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java
@@ -26,7 +26,7 @@
  * @bug 6899919
  * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build JarUtils CompilerUtils
+ * @build JarUtils jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm GetResourceAsStream
  */
 
@@ -40,6 +40,7 @@
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.StandardOpenOption;
+import jdk.test.lib.compiler.CompilerUtils;
 
 public class GetResourceAsStream extends Common {
     private static  final String WORK_DIR = System.getProperty("user.dir");
diff --git a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java
index f5af425..e8698dd 100644
--- a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java
+++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
  * @test
  * @bug 8153665
  * @summary Test two URLClassLoader define Package object of the same name
- * @library /lib/testlibrary
- * @build CompilerUtils
+ * @library /test/lib
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @modules jdk.compiler
  * @run testng SplitPackage
  */
@@ -38,6 +38,7 @@
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.jar.Manifest;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/java/rmi/module/ModuleTest.java b/jdk/test/java/rmi/module/ModuleTest.java
index be0b218..08fa2cd 100644
--- a/jdk/test/java/rmi/module/ModuleTest.java
+++ b/jdk/test/java/rmi/module/ModuleTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @build jdk.testlibrary.ProcessTools
- *        ModuleTest CompilerUtils JarUtils
+ *        ModuleTest jdk.test.lib.compiler.CompilerUtils JarUtils
  * @run testng ModuleTest
  * @summary Basic tests for using rmi in module world
  */
@@ -36,6 +36,7 @@
 
 import java.io.File;
 import java.nio.file.Paths;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/java/security/Provider/SecurityProviderModularTest.java b/jdk/test/java/security/Provider/SecurityProviderModularTest.java
index d35162b..713cae9 100644
--- a/jdk/test/java/security/Provider/SecurityProviderModularTest.java
+++ b/jdk/test/java/security/Provider/SecurityProviderModularTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import java.lang.module.ModuleDescriptor;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.compiler.CompilerUtils;
 import org.testng.annotations.BeforeTest;
 
 /**
@@ -40,8 +41,9 @@
  * @bug 8130360
  * @library /lib/testlibrary
  * @library /java/security/modules
+ * @library /test/lib
  * @modules java.base/jdk.internal.module
- * @build CompilerUtils JarUtils
+ * @build jdk.test.lib.compiler.CompilerUtils JarUtils
  * @summary Test custom security provider module with all possible modular
  *          condition. The test includes different combination of security
  *          client/provider modules interaction with or without service
diff --git a/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java b/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java
index 15d75ae..865dc38 100644
--- a/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java
+++ b/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,9 @@
 /**
  * @test
  * @bug 8170772
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build CacheTest CompilerUtils jdk.testlibrary.*
+ * @build CacheTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng CacheTest
  */
 
@@ -37,12 +37,12 @@
 
 import jdk.testlibrary.OutputAnalyzer;
 import static jdk.testlibrary.ProcessTools.*;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
-
 @Test
 public class CacheTest {
 
diff --git a/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java b/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java
index b3eef5d..e0e76ff 100644
--- a/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java
+++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java
@@ -24,9 +24,10 @@
 /*
  * @test
  * @bug 8177980
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build CompilerUtils jdk.testlibrary.ProcessTools CaseInsensitiveNameClash
+ * @build jdk.test.lib.compiler.CompilerUtils
+ *        jdk.testlibrary.ProcessTools CaseInsensitiveNameClash
  * @run testng CaseInsensitiveNameClash
  */
 
@@ -34,6 +35,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/java/util/ResourceBundle/modules/security/TestPermission.java b/jdk/test/java/util/ResourceBundle/modules/security/TestPermission.java
index 14db7ad..43e4abe 100644
--- a/jdk/test/java/util/ResourceBundle/modules/security/TestPermission.java
+++ b/jdk/test/java/util/ResourceBundle/modules/security/TestPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 import java.util.Arrays;
 import java.util.List;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.executeTestJava;
 
 import org.testng.annotations.BeforeTest;
@@ -34,9 +35,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build TestPermission CompilerUtils jdk.testlibrary.*
+ * @build TestPermission jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng TestPermission
  * @summary Driver for testing ResourceBundle::getBundle(String, Module)
  */
diff --git a/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java b/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java
index a1bf4ab..84392b1 100644
--- a/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java
+++ b/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng/othervm BadProvidersTest
  * @summary Basic test of ServiceLoader with bad provider and bad provider
  *          factories deployed on the module path
@@ -44,6 +44,8 @@
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import jdk.test.lib.compiler.CompilerUtils;
+
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
 import static org.testng.Assert.*;
diff --git a/jdk/test/java/util/logging/modules/GetResourceBundleTest.java b/jdk/test/java/util/logging/modules/GetResourceBundleTest.java
index 5c771b9..5167a21 100644
--- a/jdk/test/java/util/logging/modules/GetResourceBundleTest.java
+++ b/jdk/test/java/util/logging/modules/GetResourceBundleTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,15 +30,17 @@
 
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
 import static jdk.testlibrary.ProcessTools.*;
+import jdk.test.lib.compiler.CompilerUtils;
 import static org.testng.Assert.*;
 
 /**
  * @test
  * @bug 8129126 8136802 8137316 8137317 8136804 8139350
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
  *          java.logging
- * @build GetResourceBundleTest CompilerUtils jdk.testlibrary.ProcessTools
+ * @build GetResourceBundleTest jdk.testlibrary.ProcessTools
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng GetResourceBundleTest
  * @summary Tests Logger.getLogger + logger.getResourceBundle in an named/unnamed module,
  *          resources are in named and unnamed modules respectively.
diff --git a/jdk/test/javax/security/auth/login/modules/JaasModularClientTest.java b/jdk/test/javax/security/auth/login/modules/JaasModularClientTest.java
index 20763ba..b0bc459 100644
--- a/jdk/test/javax/security/auth/login/modules/JaasModularClientTest.java
+++ b/jdk/test/javax/security/auth/login/modules/JaasModularClientTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,15 @@
 import java.util.ArrayList;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.compiler.CompilerUtils;
 import org.testng.annotations.BeforeTest;
 
 /**
  * @test
  * @bug 8078813
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @library /java/security/modules
- * @build CompilerUtils JarUtils
+ * @build jdk.test.lib.compiler.CompilerUtils JarUtils
  * @summary Test custom JAAS module with all possible modular option. The test
  *          includes different combination of JAAS client/login modules
  *          interaction with or without service description.
diff --git a/jdk/test/javax/security/auth/login/modules/JaasModularDefaultHandlerTest.java b/jdk/test/javax/security/auth/login/modules/JaasModularDefaultHandlerTest.java
index 14dc31e..efdadc2 100644
--- a/jdk/test/javax/security/auth/login/modules/JaasModularDefaultHandlerTest.java
+++ b/jdk/test/javax/security/auth/login/modules/JaasModularDefaultHandlerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import java.io.IOException;
 import java.lang.module.ModuleDescriptor;
 import java.util.ArrayList;
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.OutputAnalyzer;
 import org.testng.annotations.BeforeTest;
@@ -37,9 +38,9 @@
 /**
  * @test
  * @bug 8151654
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @library /java/security/modules
- * @build CompilerUtils JarUtils
+ * @build jdk.test.lib.compiler.CompilerUtils JarUtils
  * @summary Test custom JAAS callback handler with all possible modular option.
  * @run testng JaasModularDefaultHandlerTest
  */
diff --git a/jdk/test/jdk/modules/incubator/DefaultImage.java b/jdk/test/jdk/modules/incubator/DefaultImage.java
index dc22363..91aad2f 100644
--- a/jdk/test/jdk/modules/incubator/DefaultImage.java
+++ b/jdk/test/jdk/modules/incubator/DefaultImage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,13 @@
  * @test
  * @bug 8170859
  * @summary Ensure no incubator modules are resolved by default in the image
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng DefaultImage
  */
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.PrintStream;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleFinder;
@@ -42,6 +41,7 @@
 import java.nio.file.Paths;
 import java.util.function.Consumer;
 import java.util.stream.Stream;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/jdk/modules/incubator/ImageModules.java b/jdk/test/jdk/modules/incubator/ImageModules.java
index 7588767..857abca 100644
--- a/jdk/test/jdk/modules/incubator/ImageModules.java
+++ b/jdk/test/jdk/modules/incubator/ImageModules.java
@@ -28,7 +28,7 @@
  * @library /lib/testlibrary /test/lib
  * @key intermittent
  * @modules jdk.compiler jdk.jartool jdk.jlink
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng/othervm ImageModules
  */
 
@@ -45,6 +45,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.util.FileUtils;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.DataProvider;
diff --git a/jdk/test/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java b/jdk/test/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java
index 56bd84b..cd218b9 100644
--- a/jdk/test/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java
+++ b/jdk/test/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build RunWithAutomaticModules CompilerUtils JarUtils
+ * @build RunWithAutomaticModules jdk.test.lib.compiler.CompilerUtils JarUtils
  *        jdk.testlibrary.ProcessTools
  * @run testng RunWithAutomaticModules
  * @summary Runs tests that make use of automatic modules
@@ -35,6 +35,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.Test;
diff --git a/jdk/test/jdk/modules/scenarios/container/ContainerTest.java b/jdk/test/jdk/modules/scenarios/container/ContainerTest.java
index f562454..a0fe776 100644
--- a/jdk/test/jdk/modules/scenarios/container/ContainerTest.java
+++ b/jdk/test/jdk/modules/scenarios/container/ContainerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,12 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.jartool/sun.tools.jar
  *          jdk.compiler
  *          jdk.zipfs
  *          java.se
- * @build ContainerTest CompilerUtils jdk.testlibrary.*
+ * @build ContainerTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng ContainerTest
  * @summary Starts a simple container that uses dynamic configurations
  *          and launches two applications in the same VM
@@ -38,6 +38,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
diff --git a/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java b/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java
index 8dc2060..fb36288 100644
--- a/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java
+++ b/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build OverlappingPackagesTest CompilerUtils jdk.testlibrary.*
+ * @build OverlappingPackagesTest jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng OverlappingPackagesTest
  * @summary Basic test to ensure that startup fails if two or more modules
  *          in the boot Layer have the same package
@@ -36,6 +37,7 @@
 import java.util.Arrays;
 import java.util.List;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
diff --git a/jdk/test/lib/testlibrary/CompilerUtils.java b/jdk/test/lib/testlibrary/CompilerUtils.java
deleted file mode 100644
index 261c2c8..0000000
--- a/jdk/test/lib/testlibrary/CompilerUtils.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import javax.tools.JavaCompiler;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * This class consists exclusively of static utility methods for invoking the
- * java compiler.
- */
-
-public final class CompilerUtils {
-    private CompilerUtils() { }
-
-    /**
-     * Compile all the java sources in {@code <source>/**} to
-     * {@code <destination>/**}. The destination directory will be created if
-     * it doesn't exist.
-     *
-     * All warnings/errors emitted by the compiler are output to System.out/err.
-     *
-     * @return true if the compilation is successful
-     *
-     * @throws IOException
-     *         if there is an I/O error scanning the source tree or
-     *         creating the destination directory
-     * @throws UnsupportedOperationException
-     *         if there is no system java compiler
-     */
-    public static boolean compile(Path source, Path destination, String ... options)
-        throws IOException
-    {
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        if (compiler == null) {
-            // no compiler available
-            throw new UnsupportedOperationException("Unable to get system java compiler. " +
-                "Perhaps, jdk.compiler module is not available.");
-        }
-        StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
-
-        List<Path> sources
-            = Files.find(source, Integer.MAX_VALUE,
-                (file, attrs) -> (file.toString().endsWith(".java")))
-                .collect(Collectors.toList());
-
-        Files.createDirectories(destination);
-        jfm.setLocation(StandardLocation.CLASS_PATH, Collections.EMPTY_LIST);
-        jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT,
-                                 Arrays.asList(destination));
-
-        List<String> opts = Arrays.asList(options);
-        JavaCompiler.CompilationTask task
-            = compiler.getTask(null, jfm, null, opts, null,
-                jfm.getJavaFileObjectsFromPaths(sources));
-
-        return task.call();
-    }
-}
diff --git a/jdk/test/sun/net/www/protocol/jar/jarbug/TestDriver.java b/jdk/test/sun/net/www/protocol/jar/jarbug/TestDriver.java
index b7ddeb6..3754e37 100644
--- a/jdk/test/sun/net/www/protocol/jar/jarbug/TestDriver.java
+++ b/jdk/test/sun/net/www/protocol/jar/jarbug/TestDriver.java
@@ -27,7 +27,8 @@
  * @library /test/lib
  *          /lib/testlibrary
  * @modules jdk.compiler
- * @build src.test.src.TestDriver CompilerUtils JarUtils
+ * @build src.test.src.TestDriver JarUtils
+ *        jdk.test.lib.CompilerUtils
  *        jdk.test.lib.JDKToolFinder
  *        jdk.test.lib.process.*
  * @summary various resource and classloading bugs related to jar files
diff --git a/jdk/test/sun/security/tools/jarsigner/AltProvider.java b/jdk/test/sun/security/tools/jarsigner/AltProvider.java
index b8d689b..f44f9e4 100644
--- a/jdk/test/sun/security/tools/jarsigner/AltProvider.java
+++ b/jdk/test/sun/security/tools/jarsigner/AltProvider.java
@@ -25,7 +25,7 @@
  * @test
  * @bug 4906940 8130302
  * @summary -providerPath, -providerClass, -addprovider, and -providerArg
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.misc
  */
 
@@ -33,6 +33,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.util.JarUtils;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import java.nio.file.*;
 
diff --git a/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java b/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java
index 57b2623..2051c25 100644
--- a/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java
+++ b/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java
@@ -26,7 +26,6 @@
  * @bug 8047305 8075618
  * @summary Tests jarsigner tool and JarSigner API work with multi-release JAR files.
  * @library /test/lib
- * @library /lib/testlibrary
  * @run main MVJarSigningTest
  */
 
@@ -59,6 +58,7 @@
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
diff --git a/jdk/test/tools/jlink/basic/AllModulePath.java b/jdk/test/tools/jlink/basic/AllModulePath.java
index 3053c34..2530184 100644
--- a/jdk/test/tools/jlink/basic/AllModulePath.java
+++ b/jdk/test/tools/jlink/basic/AllModulePath.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,11 @@
 /*
  * @test
  * @summary jlink test of --add-module ALL-MODULE-PATH
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
  * @build jdk.testlibrary.ProcessTools
  *        jdk.testlibrary.OutputAnalyzer
- *        CompilerUtils
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng AllModulePath
  */
 
@@ -48,6 +48,7 @@
 import java.util.stream.Stream;
 import java.util.spi.ToolProvider;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.ProcessTools;
 
 import org.testng.annotations.BeforeClass;
diff --git a/jdk/test/tools/jlink/basic/BasicTest.java b/jdk/test/tools/jlink/basic/BasicTest.java
index ae49a01..94499f2 100644
--- a/jdk/test/tools/jlink/basic/BasicTest.java
+++ b/jdk/test/tools/jlink/basic/BasicTest.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,13 @@
  * @test
  * @summary Basic test of jlink to create jmods and images
  * @author Andrei Eremeev
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules java.base/jdk.internal.module
  *          jdk.jlink
  *          jdk.compiler
  * @build jdk.testlibrary.ProcessTools
  *        jdk.testlibrary.OutputAnalyzer
- *        JarUtils CompilerUtils
+ *        JarUtils jdk.test.lib.compiler.CompilerUtils
  * @run main BasicTest
  */
 
@@ -45,6 +45,7 @@
 import java.util.List;
 import java.util.spi.ToolProvider;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
 
diff --git a/jdk/test/tools/jlink/bindservices/BindServices.java b/jdk/test/tools/jlink/bindservices/BindServices.java
index b4ab4cc..c165e04 100644
--- a/jdk/test/tools/jlink/bindservices/BindServices.java
+++ b/jdk/test/tools/jlink/bindservices/BindServices.java
@@ -33,6 +33,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
@@ -42,9 +43,10 @@
 /**
  * @test
  * @bug 8174826
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler jdk.jlink
- * @build BindServices CompilerUtils jdk.testlibrary.ProcessTools
+ * @build BindServices jdk.testlibrary.ProcessTools
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng BindServices
  */
 
diff --git a/jdk/test/tools/jlink/bindservices/SuggestProviders.java b/jdk/test/tools/jlink/bindservices/SuggestProviders.java
index d7e5b6c..9685f92 100644
--- a/jdk/test/tools/jlink/bindservices/SuggestProviders.java
+++ b/jdk/test/tools/jlink/bindservices/SuggestProviders.java
@@ -32,6 +32,7 @@
 import java.util.spi.ToolProvider;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -40,9 +41,9 @@
 /**
  * @test
  * @bug 8174826
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.charsets jdk.compiler jdk.jlink
- * @build SuggestProviders CompilerUtils
+ * @build SuggestProviders jdk.test.lib.compiler.CompilerUtils
  * @run testng SuggestProviders
  */
 
diff --git a/jdk/test/tools/jlink/plugins/ExcludeJmodSectionPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeJmodSectionPluginTest.java
index 810a751..072694f 100644
--- a/jdk/test/tools/jlink/plugins/ExcludeJmodSectionPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/ExcludeJmodSectionPluginTest.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,10 @@
 /*
  * @test
  * @summary Test --no-man-pages and --no-header-files
- * @library /lib/testlibrary
+ * @library /test/lib
  * @modules jdk.compiler
  *          jdk.jlink
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng ExcludeJmodSectionPluginTest
  */
 
@@ -48,6 +48,7 @@
 import java.util.spi.ToolProvider;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.DataProvider;
diff --git a/jdk/test/tools/jlink/plugins/LegalFilePluginTest.java b/jdk/test/tools/jlink/plugins/LegalFilePluginTest.java
index d5b3dfd..7d49ae1 100644
--- a/jdk/test/tools/jlink/plugins/LegalFilePluginTest.java
+++ b/jdk/test/tools/jlink/plugins/LegalFilePluginTest.java
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,10 @@
  * @test
  * @bug 8169925
  * @summary Validate the license files deduplicated in the image
- * @library /lib/testlibrary
+ * @library /test/lib
  * @modules jdk.compiler
  *          jdk.jlink
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng LegalFilePluginTest
  */
 
@@ -53,6 +53,7 @@
 import java.util.spi.ToolProvider;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import jdk.test.lib.compiler.CompilerUtils;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.DataProvider;
diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java
index c148e5a..15babb5 100644
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java
@@ -29,6 +29,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.util.FileUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
@@ -41,7 +42,8 @@
  * @test
  * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler jdk.jlink
- * @build CompiledVersionTest CompilerUtils jdk.testlibrary.ProcessTools
+ * @build CompiledVersionTest jdk.testlibrary.ProcessTools
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng CompiledVersionTest
  */
 
diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java
index 9c839d7..6c849f3 100644
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java
@@ -32,6 +32,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.util.FileUtils;
 
 import static jdk.testlibrary.ProcessTools.*;
@@ -47,7 +48,8 @@
  * @modules jdk.compiler jdk.jlink
  * @modules java.base/jdk.internal.module
  * @modules java.base/jdk.internal.org.objectweb.asm
- * @build ModuleTargetHelper UserModuleTest CompilerUtils jdk.testlibrary.ProcessTools
+ * @build ModuleTargetHelper UserModuleTest jdk.testlibrary.ProcessTools
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng UserModuleTest
  */
 
diff --git a/jdk/test/tools/jmod/JmodNegativeTest.java b/jdk/test/tools/jmod/JmodNegativeTest.java
index bcb4055..3bc2359 100644
--- a/jdk/test/tools/jmod/JmodNegativeTest.java
+++ b/jdk/test/tools/jmod/JmodNegativeTest.java
@@ -23,10 +23,10 @@
 
 /*
  * @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  *          jdk.jlink
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng JmodNegativeTest
  * @summary Negative tests for jmod
  */
@@ -42,6 +42,7 @@
 import java.util.spi.ToolProvider;
 import java.util.zip.ZipOutputStream;
 import jdk.test.lib.util.FileUtils;
+import jdk.test.lib.compiler.CompilerUtils;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
diff --git a/jdk/test/tools/jmod/JmodTest.java b/jdk/test/tools/jmod/JmodTest.java
index 30df12f..ffd3a90 100644
--- a/jdk/test/tools/jmod/JmodTest.java
+++ b/jdk/test/tools/jmod/JmodTest.java
@@ -25,10 +25,10 @@
  * @test
  * @bug 8142968 8166568 8166286 8170618 8168149
  * @summary Basic test for jmod
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  *          jdk.jlink
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng/othervm -Djava.io.tmpdir=. JmodTest
  */
 
@@ -41,6 +41,7 @@
 import java.util.regex.Pattern;
 import java.util.spi.ToolProvider;
 import java.util.stream.Stream;
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.util.FileUtils;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
diff --git a/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java b/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java
index c92824f..64505f8 100644
--- a/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java
+++ b/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build AddExportsTest CompilerUtils jdk.testlibrary.*
+ * @build AddExportsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng AddExportsTest
  * @summary Basic tests for java --add-exports
  */
@@ -34,6 +34,7 @@
 import java.nio.file.Paths;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.OutputAnalyzer;
 import static jdk.testlibrary.ProcessTools.*;
 
diff --git a/jdk/test/tools/launcher/modules/addmods/AddModsTest.java b/jdk/test/tools/launcher/modules/addmods/AddModsTest.java
index d60c2ea..9ca2523 100644
--- a/jdk/test/tools/launcher/modules/addmods/AddModsTest.java
+++ b/jdk/test/tools/launcher/modules/addmods/AddModsTest.java
@@ -23,10 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.jlink/jdk.tools.jmod
  *          jdk.compiler
- * @build AddModsTest CompilerUtils jdk.testlibrary.*
+ * @build AddModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng AddModsTest
  * @summary Basic test for java --add-modules
  */
@@ -35,6 +35,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
diff --git a/jdk/test/tools/launcher/modules/addreads/AddReadsTest.java b/jdk/test/tools/launcher/modules/addreads/AddReadsTest.java
index 6d0b4a7..09a1360 100644
--- a/jdk/test/tools/launcher/modules/addreads/AddReadsTest.java
+++ b/jdk/test/tools/launcher/modules/addreads/AddReadsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build AddReadsTest CompilerUtils JarUtils jdk.testlibrary.*
+ * @build AddReadsTest JarUtils jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng AddReadsTest
  * @summary Basic tests for java --add-reads
  */
@@ -33,6 +34,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.OutputAnalyzer;
 import static jdk.testlibrary.ProcessTools.*;
 
diff --git a/jdk/test/tools/launcher/modules/basic/BasicTest.java b/jdk/test/tools/launcher/modules/basic/BasicTest.java
index 3256f35..91629f6 100644
--- a/jdk/test/tools/launcher/modules/basic/BasicTest.java
+++ b/jdk/test/tools/launcher/modules/basic/BasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,11 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
  *          jdk.jartool
  *          jdk.jlink
- * @build BasicTest CompilerUtils jdk.testlibrary.*
+ * @build BasicTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng BasicTest
  * @summary Basic test of starting an application as a module
  */
@@ -38,6 +38,7 @@
 import java.nio.file.Paths;
 import java.util.spi.ToolProvider;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.ProcessTools;
 
 import org.testng.annotations.BeforeTest;
diff --git a/jdk/test/tools/launcher/modules/classpath/JavaClassPathTest.java b/jdk/test/tools/launcher/modules/classpath/JavaClassPathTest.java
index afac422..cd26a99 100644
--- a/jdk/test/tools/launcher/modules/classpath/JavaClassPathTest.java
+++ b/jdk/test/tools/launcher/modules/classpath/JavaClassPathTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import java.util.Map;
 import java.util.spi.ToolProvider;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.OutputAnalyzer;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.DataProvider;
@@ -42,10 +43,10 @@
  * @test
  * @bug 8168205
  * @summary Test the default class path if -Djava.class.path is set
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
  *          jdk.jartool
- * @build CompilerUtils jdk.testlibrary.*
+ * @build jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng JavaClassPathTest
  */
 
diff --git a/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java b/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java
index afb1fbc..2c4e7e1 100644
--- a/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java
+++ b/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,11 @@
 /**
  * @test
  * @bug 8159596
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
  *          jdk.jartool
- * @build DryRunTest CompilerUtils jdk.testlibrary.ProcessTools
+ * @build DryRunTest jdk.testlibrary.ProcessTools
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng DryRunTest
  * @summary Test java --dry-run
  */
@@ -39,13 +40,13 @@
 import java.nio.file.Paths;
 import java.util.spi.ToolProvider;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.ProcessTools;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
-
 @Test
 public class DryRunTest {
 
diff --git a/jdk/test/tools/launcher/modules/limitmods/LimitModsTest.java b/jdk/test/tools/launcher/modules/limitmods/LimitModsTest.java
index 208e36f..e898837 100644
--- a/jdk/test/tools/launcher/modules/limitmods/LimitModsTest.java
+++ b/jdk/test/tools/launcher/modules/limitmods/LimitModsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules java.desktop java.logging jdk.compiler
- * @build LimitModsTest CompilerUtils jdk.testlibrary.*
+ * @build LimitModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng LimitModsTest
  * @summary Basic tests for java --limit-modules
  */
@@ -33,13 +33,13 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
-
 @Test
 public class LimitModsTest {
 
diff --git a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java
index 4fd8984..913f17e 100644
--- a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java
+++ b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java
@@ -23,9 +23,9 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules java.se
- * @build ListModsTest CompilerUtils jdk.testlibrary.*
+ * @build ListModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
  * @run testng ListModsTest
  * @summary Basic test for java --list-modules
  */
@@ -33,6 +33,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.OutputAnalyzer;
 
diff --git a/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java b/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java
index 15457cf..e1ba5ba 100644
--- a/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java
+++ b/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build PatchTest CompilerUtils JarUtils jdk.testlibrary.*
+ * @build PatchTest JarUtils jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng PatchTest
  * @summary Basic test for --patch-module
  */
@@ -37,13 +38,13 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
-
 /**
  * Compiles and launches a test that uses --patch-module with two directories
  * of classes to override existing classes and add new classes to modules in
diff --git a/jdk/test/tools/launcher/modules/patch/basic/PatchTestWarningError.java b/jdk/test/tools/launcher/modules/patch/basic/PatchTestWarningError.java
index 2d5b14b..6bf6b97 100644
--- a/jdk/test/tools/launcher/modules/patch/basic/PatchTestWarningError.java
+++ b/jdk/test/tools/launcher/modules/patch/basic/PatchTestWarningError.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,10 @@
  * @test
  * @bug 8168836
  * @summary Basic argument validation for --patch-module
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build PatchTestWarningError CompilerUtils JarUtils jdk.testlibrary.*
+ * @build PatchTestWarningError JarUtils jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng PatchTestWarningError
  */
 
@@ -38,6 +39,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java
index b895ed4..aad3bd8 100644
--- a/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java
+++ b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java
@@ -27,7 +27,7 @@
  * @summary Patch java.base and user module with ModuleHashes attribute
  * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build CompilerUtils
+ * @build jdk.test.lib.compiler.CompilerUtils
  * @run testng PatchSystemModules
  */
 
@@ -39,6 +39,7 @@
 import java.util.List;
 import java.util.stream.Stream;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.util.FileUtils;
 import jdk.testlibrary.JDKToolFinder;
 import org.testng.annotations.BeforeTest;
diff --git a/jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java b/jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java
index 3655281..9ece8ee 100644
--- a/jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java
+++ b/jdk/test/tools/launcher/modules/upgrademodulepath/UpgradeModulePathTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
  * @modules jdk.compiler
- * @build UpgradeModulePathTest CompilerUtils jdk.testlibrary.*
+ * @build UpgradeModulePathTest jdk.testlibrary.*
+ *        jdk.test.lib.compiler.CompilerUtils
  * @run testng UpgradeModulePathTest
  * @summary Basic test for java --upgrade-module-path
  */
@@ -34,6 +35,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import jdk.test.lib.compiler.CompilerUtils;
 import static jdk.testlibrary.ProcessTools.executeTestJava;
 
 import org.testng.annotations.BeforeTest;
@@ -46,7 +48,6 @@
  * modue path.
  */
 
-
 @Test
 public class UpgradeModulePathTest {
 
diff --git a/jdk/test/tools/schemagen/MultiReleaseJarTest.java b/jdk/test/tools/schemagen/MultiReleaseJarTest.java
index e3b6563..26aa230 100644
--- a/jdk/test/tools/schemagen/MultiReleaseJarTest.java
+++ b/jdk/test/tools/schemagen/MultiReleaseJarTest.java
@@ -25,18 +25,18 @@
  * @test
  * @summary Test Multi-Release jar support in schemagen tool
  * @library /test/lib
- * @library /lib/testlibrary
  * @modules jdk.compiler java.xml.ws
  * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
  *        jdk.test.lib.process.OutputAnalyzer
  *        jdk.test.lib.process.ProcessTools
  *        jdk.test.lib.Utils
- *        CompilerUtils MultiReleaseJarTest
+ *        jdk.test.lib.compiler.CompilerUtils MultiReleaseJarTest
  * @run testng MultiReleaseJarTest
  */
 
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import org.testng.annotations.BeforeClass;
@@ -114,4 +114,5 @@
                     "--add-modules", "java.xml.ws"));
         }
     }
-}
\ No newline at end of file
+}
+
diff --git a/jdk/test/tools/wsgen/MultiReleaseJarTest.java b/jdk/test/tools/wsgen/MultiReleaseJarTest.java
index 294c413..c695341 100644
--- a/jdk/test/tools/wsgen/MultiReleaseJarTest.java
+++ b/jdk/test/tools/wsgen/MultiReleaseJarTest.java
@@ -25,18 +25,18 @@
  * @test
  * @summary Test Multi-Release jar support in wsgen tool
  * @library /test/lib
- * @library /lib/testlibrary
  * @modules jdk.compiler java.xml.ws
  * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
  *        jdk.test.lib.process.OutputAnalyzer
  *        jdk.test.lib.process.ProcessTools
  *        jdk.test.lib.Utils
- *        CompilerUtils MultiReleaseJarTest
+ *        jdk.test.lib.compiler.CompilerUtils MultiReleaseJarTest
  * @run testng MultiReleaseJarTest
  */
 
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import org.testng.annotations.BeforeClass;
@@ -117,4 +117,5 @@
                     "--add-modules", "java.xml.ws"));
         }
     }
-}
\ No newline at end of file
+}
+