diff --git a/.hgtags b/.hgtags
index 3b55eb9..6d6aabc 100644
--- a/.hgtags
+++ b/.hgtags
@@ -316,3 +316,4 @@
 6e223d48080ef40f4ec11ecbcd19b4a20813b9eb jdk8u40-b01
 4797cd0713b44b009525f1276d571ade7e24f3f5 jdk8u40-b02
 c67acfb24eed87629887128df51007218ddf1f60 jdk8u40-b03
+dde62d949f7847469b2ede2ca4190c95066adc91 jdk8u40-b04
diff --git a/make/CompileNativeLibraries.gmk b/make/CompileNativeLibraries.gmk
index 57ef12e..c23b958 100644
--- a/make/CompileNativeLibraries.gmk
+++ b/make/CompileNativeLibraries.gmk
@@ -87,6 +87,9 @@
 
 include lib/SoundLibraries.gmk
 
+# Include the corresponding custom file, if present. 
+-include $(CUSTOM_MAKE_DIR)/CompileNativeLibraries.gmk
+
 ##########################################################################################
 
 all: $(COPY_FILES) $(BUILD_LIBRARIES)
diff --git a/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java b/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java
new file mode 100644
index 0000000..7f676ee
--- /dev/null
+++ b/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package com.sun.tools.attach;
+
+import java.io.IOException;
+
+/**
+ * Exception type to signal that an attach operation failed in the target VM.
+ *
+ * <p> This exception can be thrown by the various operations of
+ * {@link com.sun.tools.attach.VirtualMachine} when the operation
+ * fails in the target VM. If there is a communication error,
+ * a regular IOException will be thrown.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public class AttachOperationFailedException extends IOException {
+
+    private static final long serialVersionUID = 2140308168167478043L;
+
+    /**
+     * Constructs an <code>AttachOperationFailedException</code> with
+     * the specified detail message.
+     *
+     * @param   s   the detail message.
+     */
+    public AttachOperationFailedException(String message) {
+        super(message);
+    }
+}
diff --git a/src/share/classes/com/sun/tools/attach/VirtualMachine.java b/src/share/classes/com/sun/tools/attach/VirtualMachine.java
index 1bea751..d5e934a 100644
--- a/src/share/classes/com/sun/tools/attach/VirtualMachine.java
+++ b/src/share/classes/com/sun/tools/attach/VirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -76,16 +76,10 @@
  *      // attach to target VM
  *      VirtualMachine vm = VirtualMachine.attach("2177");
  *
- *      // get system properties in target VM
- *      Properties props = vm.getSystemProperties();
- *
- *      // construct path to management agent
- *      String home = props.getProperty("java.home");
- *      String agent = home + File.separator + "lib" + File.separator
- *          + "management-agent.jar";
- *
- *      // load agent into target VM
- *      vm.loadAgent(agent, "com.sun.management.jmxremote.port=5000");
+ *      // start management agent
+ *      Properties props = new Properties();
+ *      props.put("com.sun.management.jmxremote.port", "5000");
+ *      vm.startManagementAgent(props);
  *
  *      // detach
  *      vm.detach();
@@ -93,9 +87,9 @@
  * </pre>
  *
  * <p> In this example we attach to a Java virtual machine that is identified by
- * the process identifier <code>2177</code>. The system properties from the target
- * VM are then used to construct the path to a <i>management agent</i> which is then
- * loaded into the target VM. Once loaded the client detaches from the target VM. </p>
+ * the process identifier <code>2177</code>. Then the JMX management agent is
+ * started in the target process using the supplied arguments. Finally, the
+ * client detaches from the target VM. </p>
  *
  * <p> A VirtualMachine is safe for use by multiple concurrent threads. </p>
  *
@@ -564,8 +558,15 @@
      *
      * @return  The system properties
      *
+     * @throws  AttachOperationFailedException
+     *          If the target virtual machine is unable to complete the
+     *          attach operation. A more specific error message will be
+     *          given by {@link AttachOperationFailedException#getMessage()}.
+     *
      * @throws  IOException
-     *          If an I/O error occurs
+     *          If an I/O error occurs, a communication error for example,
+     *          that cannot be identified as an error to indicate that the
+     *          operation failed in the target VM.
      *
      * @see     java.lang.System#getProperties
      * @see     #loadAgentLibrary
@@ -591,12 +592,81 @@
      *
      * @return       The agent properties
      *
+     * @throws       AttachOperationFailedException
+     *               If the target virtual machine is unable to complete the
+     *               attach operation. A more specific error message will be
+     *               given by {@link AttachOperationFailedException#getMessage()}.
+     *
      * @throws       IOException
-     *               If an I/O error occurs
+     *               If an I/O error occurs, a communication error for example,
+     *               that cannot be identified as an error to indicate that the
+     *               operation failed in the target VM.
      */
     public abstract Properties getAgentProperties() throws IOException;
 
     /**
+     * Starts the JMX management agent in the target virtual machine.
+     *
+     * <p> The configuration properties are the same as those specified on
+     * the command line when starting the JMX management agent. In the same
+     * way as on the command line, you need to specify at least the
+     * {@code com.sun.management.jmxremote.port} property.
+     *
+     * <p> See the online documentation for <a
+     * href="../../../../../../../../technotes/guides/management/agent.html">
+     * Monitoring and Management Using JMX Technology</a> for further details.
+     *
+     * @param   agentProperties
+     *          A Properties object containing the configuration properties
+     *          for the agent.
+     *
+     * @throws  AttachOperationFailedException
+     *          If the target virtual machine is unable to complete the
+     *          attach operation. A more specific error message will be
+     *          given by {@link AttachOperationFailedException#getMessage()}.
+     *
+     * @throws  IOException
+     *          If an I/O error occurs, a communication error for example,
+     *          that cannot be identified as an error to indicate that the
+     *          operation failed in the target VM.
+     *
+     * @throws  IllegalArgumentException
+     *          If keys or values in agentProperties are invalid.
+     *
+     * @throws  NullPointerException
+     *          If agentProperties is null.
+     *
+     * @since   1.8
+     */
+    public abstract void startManagementAgent(Properties agentProperties) throws IOException;
+
+    /**
+     * Starts the local JMX management agent in the target virtual machine.
+     *
+     * <p> See the online documentation for <a
+     * href="../../../../../../../../technotes/guides/management/agent.html">
+     * Monitoring and Management Using JMX Technology</a> for further details.
+     *
+     * @return  The String representation of the local connector's service address.
+     *          The value can be parsed by the
+     *          {@link javax.management.remote.JMXServiceURL#JMXServiceURL(String)}
+     *          constructor.
+     *
+     * @throws  AttachOperationFailedException
+     *          If the target virtual machine is unable to complete the
+     *          attach operation. A more specific error message will be
+     *          given by {@link AttachOperationFailedException#getMessage()}.
+     *
+     * @throws  IOException
+     *          If an I/O error occurs, a communication error for example,
+     *          that cannot be identified as an error to indicate that the
+     *          operation failed in the target VM.
+     *
+     * @since   1.8
+     */
+    public abstract String startLocalManagementAgent() throws IOException;
+
+    /**
      * Returns a hash-code value for this VirtualMachine. The hash
      * code is based upon the VirtualMachine's components, and satifies
      * the general contract of the {@link java.lang.Object#hashCode()
diff --git a/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
index 4b858bb..bf2e951 100644
--- a/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
+++ b/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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,7 +33,7 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.util.Properties;
-import java.util.Map;
+import java.util.stream.Collectors;
 
 /*
  * The HotSpot implementation of com.sun.tools.attach.VirtualMachine.
@@ -161,6 +161,50 @@
         return props;
     }
 
+    private static final String MANAGMENT_PREFIX = "com.sun.management.";
+
+    private static boolean checkedKeyName(Object key) {
+        if (!(key instanceof String)) {
+            throw new IllegalArgumentException("Invalid option (not a String): "+key);
+        }
+        if (!((String)key).startsWith(MANAGMENT_PREFIX)) {
+            throw new IllegalArgumentException("Invalid option: "+key);
+        }
+        return true;
+    }
+
+    private static String stripKeyName(Object key) {
+        return ((String)key).substring(MANAGMENT_PREFIX.length());
+    }
+
+    @Override
+    public void startManagementAgent(Properties agentProperties) throws IOException {
+        if (agentProperties == null) {
+            throw new NullPointerException("agentProperties cannot be null");
+        }
+        // Convert the arguments into arguments suitable for the Diagnostic Command:
+        // "ManagementAgent.start jmxremote.port=5555 jmxremote.authenticate=false"
+        String args = agentProperties.entrySet().stream()
+            .filter(entry -> checkedKeyName(entry.getKey()))
+            .map(entry -> stripKeyName(entry.getKey()) + "=" + escape(entry.getValue()))
+            .collect(Collectors.joining(" "));
+        executeJCmd("ManagementAgent.start " + args);
+    }
+
+    private String escape(Object arg) {
+        String value = arg.toString();
+        if (value.contains(" ")) {
+            return "'" + value + "'";
+        }
+        return value;
+    }
+
+    @Override
+    public String startLocalManagementAgent() throws IOException {
+        executeJCmd("ManagementAgent.start_local");
+        return getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
+    }
+
     // --- HotSpot specific methods ---
 
     // same as SIGQUIT
@@ -257,6 +301,20 @@
         return value;
     }
 
+    /*
+     * Utility method to read data into a String.
+     */
+    String readErrorMessage(InputStream sis) throws IOException {
+        byte b[] = new byte[1024];
+        int n;
+        StringBuffer message = new StringBuffer();
+        while ((n = sis.read(b)) != -1) {
+            message.append(new String(b, 0, n, "UTF-8"));
+        }
+        return message.toString();
+    }
+
+
     // -- attach timeout support
 
     private static long defaultAttachTimeout = 5000;
diff --git a/src/share/classes/sun/tools/jcmd/JCmd.java b/src/share/classes/sun/tools/jcmd/JCmd.java
index 8c5a2c5..0ff4632 100644
--- a/src/share/classes/sun/tools/jcmd/JCmd.java
+++ b/src/share/classes/sun/tools/jcmd/JCmd.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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,10 +33,12 @@
 import java.util.Comparator;
 import java.net.URISyntaxException;
 
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.VirtualMachineDescriptor;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
+
 import sun.tools.attach.HotSpotVirtualMachine;
 import sun.tools.jstat.JStatLogger;
 import sun.jvmstat.monitor.Monitor;
@@ -119,6 +121,7 @@
             pids.add(arg.getPid() + "");
         }
 
+        boolean success = true;
         for (String pid : pids) {
             System.out.println(pid + ":");
             if (arg.isListCounters()) {
@@ -126,11 +129,16 @@
             } else {
                 try {
                     executeCommandForPid(pid, arg.getCommand());
+                } catch(AttachOperationFailedException ex) {
+                    System.err.println(ex.getMessage());
+                    success = false;
                 } catch(Exception ex) {
                     ex.printStackTrace();
+                    success = false;
                 }
             }
         }
+        System.exit(success ? 0 : 1);
     }
 
     private static void executeCommandForPid(String pid, String command)
@@ -150,13 +158,18 @@
                 // read to EOF and just print output
                 byte b[] = new byte[256];
                 int n;
+                boolean messagePrinted = false;
                 do {
                     n = in.read(b);
                     if (n > 0) {
                         String s = new String(b, 0, n, "UTF-8");
                         System.out.print(s);
+                        messagePrinted = true;
                     }
                 } while (n > 0);
+                if (!messagePrinted) {
+                    System.out.println("Command executed successfully");
+                }
             }
         }
         vm.detach();
diff --git a/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java b/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
index 65b03e0..e6c827b 100644
--- a/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
+++ b/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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,8 +32,6 @@
 // Sun specific
 import com.sun.tools.attach.VirtualMachine;
 import com.sun.tools.attach.VirtualMachineDescriptor;
-import com.sun.tools.attach.AgentInitializationException;
-import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 
 // Sun private
@@ -238,35 +236,7 @@
             throw ioe;
         }
 
-        String home = vm.getSystemProperties().getProperty("java.home");
-
-        // Normally in ${java.home}/jre/lib/management-agent.jar but might
-        // be in ${java.home}/lib in build environments.
-
-        String agent = home + File.separator + "jre" + File.separator +
-                           "lib" + File.separator + "management-agent.jar";
-        File f = new File(agent);
-        if (!f.exists()) {
-            agent = home + File.separator +  "lib" + File.separator +
-                        "management-agent.jar";
-            f = new File(agent);
-            if (!f.exists()) {
-                throw new IOException("Management agent not found");
-            }
-        }
-
-        agent = f.getCanonicalPath();
-        try {
-            vm.loadAgent(agent, "com.sun.management.jmxremote");
-        } catch (AgentLoadException x) {
-            IOException ioe = new IOException(x.getMessage());
-            ioe.initCause(x);
-            throw ioe;
-        } catch (AgentInitializationException x) {
-            IOException ioe = new IOException(x.getMessage());
-            ioe.initCause(x);
-            throw ioe;
-        }
+        vm.startLocalManagementAgent();
 
         // get the connector address
         Properties agentProps = vm.getAgentProperties();
diff --git a/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java b/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
index d58a4c1..ad344f1 100644
--- a/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
+++ b/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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,14 +24,14 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
-import java.util.Properties;
 
 /*
  * Bsd implementation of HotSpotVirtualMachine
@@ -191,6 +191,8 @@
         }
 
         if (completionStatus != 0) {
+            // read from the stream and use that as the error message
+            String message = readErrorMessage(sis);
             sis.close();
 
             // In the event of a protocol mismatch then the target VM
@@ -205,7 +207,11 @@
             if (cmd.equals("load")) {
                 throw new AgentLoadException("Failed to load agent library");
             } else {
-                throw new IOException("Command failed in target VM");
+                if (message == null) {
+                    throw new AttachOperationFailedException("Command failed in target VM");
+                } else {
+                    throw new AttachOperationFailedException(message);
+                }
             }
         }
 
@@ -237,8 +243,9 @@
             if ((off < 0) || (off > bs.length) || (len < 0) ||
                 ((off + len) > bs.length) || ((off + len) < 0)) {
                 throw new IndexOutOfBoundsException();
-            } else if (len == 0)
+            } else if (len == 0) {
                 return 0;
+            }
 
             return BsdVirtualMachine.read(s, bs, off, len);
         }
diff --git a/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java b/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
index 1e08d70..9dec425 100644
--- a/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
+++ b/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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,14 +24,14 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
-import java.util.Properties;
 
 /*
  * Linux implementation of HotSpotVirtualMachine
@@ -207,6 +207,8 @@
         }
 
         if (completionStatus != 0) {
+            // read from the stream and use that as the error message
+            String message = readErrorMessage(sis);
             sis.close();
 
             // In the event of a protocol mismatch then the target VM
@@ -221,7 +223,11 @@
             if (cmd.equals("load")) {
                 throw new AgentLoadException("Failed to load agent library");
             } else {
-                throw new IOException("Command failed in target VM");
+                if (message == null) {
+                    throw new AttachOperationFailedException("Command failed in target VM");
+                } else {
+                    throw new AttachOperationFailedException(message);
+                }
             }
         }
 
diff --git a/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java b/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
index c7dcf21..3c57e4b 100644
--- a/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
+++ b/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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,15 +24,15 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.util.Properties;
 
 /*
  * Solaris implementation of HotSpotVirtualMachine.
@@ -147,11 +147,17 @@
         // If non-0 it means an error but we need to special-case the
         // "load" command to ensure that the right exception is thrown.
         if (completionStatus != 0) {
+            // read from the stream and use that as the error message
+            String message = readErrorMessage(sis);
             sis.close();
             if (cmd.equals("load")) {
                 throw new AgentLoadException("Failed to load agent library");
             } else {
-                throw new IOException("Command failed in target VM");
+                if (message == null) {
+                    throw new AttachOperationFailedException("Command failed in target VM");
+                } else {
+                    throw new AttachOperationFailedException(message);
+                }
             }
         }
 
diff --git a/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c b/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
index cf3ff20..f8283ab 100644
--- a/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
+++ b/src/solaris/native/sun/tools/attach/BsdVirtualMachine.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -198,14 +198,14 @@
         len = remaining;
     }
 
-    RESTARTABLE(read(fd, buf+off, len), n);
+    RESTARTABLE(read(fd, buf, len), n);
     if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "read");
     } else {
         if (n == 0) {
             n = -1;     // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
         }
     }
     return n;
diff --git a/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c b/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
index 8c8c4eb..beb5764 100644
--- a/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
+++ b/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
@@ -416,14 +416,14 @@
         len = remaining;
     }
 
-    RESTARTABLE(read(fd, buf+off, len), n);
+    RESTARTABLE(read(fd, buf, len), n);
     if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "read");
     } else {
         if (n == 0) {
             n = -1;     // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
         }
     }
     return n;
diff --git a/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c b/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c
index 45b38ea..32dd249 100644
--- a/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c
+++ b/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -161,14 +161,14 @@
         len = remaining;
     }
 
-    RESTARTABLE(read(fd, buf+off, len), n);
+    RESTARTABLE(read(fd, buf, len), n);
     if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "read");
     } else {
         if (n == 0) {
             n = -1;     // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)n, (jbyte *)(buf));
         }
     }
     return n;
diff --git a/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java b/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java
index 6ea6677..3b34c0d 100644
--- a/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java
+++ b/src/windows/classes/sun/tools/attach/WindowsVirtualMachine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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,15 +24,15 @@
  */
 package sun.tools.attach;
 
-import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AttachOperationFailedException;
 import com.sun.tools.attach.AgentLoadException;
 import com.sun.tools.attach.AttachNotSupportedException;
 import com.sun.tools.attach.spi.AttachProvider;
+
 import sun.tools.attach.HotSpotVirtualMachine;
+
 import java.io.IOException;
-import java.io.File;
 import java.io.InputStream;
-import java.util.Properties;
 import java.util.Random;
 
 public class WindowsVirtualMachine extends HotSpotVirtualMachine {
@@ -105,11 +105,17 @@
             // read completion status
             int status = readInt(is);
             if (status != 0) {
+                // read from the stream and use that as the error message
+                String message = readErrorMessage(is);
                 // special case the load command so that the right exception is thrown
                 if (cmd.equals("load")) {
                     throw new AgentLoadException("Failed to load agent library");
                 } else {
-                    throw new IOException("Command failed in target VM");
+                    if (message == null) {
+                        throw new AttachOperationFailedException("Command failed in target VM");
+                    } else {
+                        throw new AttachOperationFailedException(message);
+                    }
                 }
             }
 
diff --git a/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
index d701672..82628e1 100644
--- a/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
+++ b/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
@@ -341,7 +341,7 @@
         if (nread == 0) {
             return (jint)-1;        // EOF
         } else {
-            (*env)->SetByteArrayRegion(env, ba, off, (jint)nread, (jbyte *)(buf+off));
+            (*env)->SetByteArrayRegion(env, ba, off, (jint)nread, (jbyte *)(buf));
         }
     }
 
diff --git a/test/com/sun/tools/attach/SimpleProvider.java b/test/com/sun/tools/attach/SimpleProvider.java
index 2a380f5..54f3dad 100644
--- a/test/com/sun/tools/attach/SimpleProvider.java
+++ b/test/com/sun/tools/attach/SimpleProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -100,4 +100,12 @@
 
     public void dataDumpRequest() throws IOException {
     }
+
+    public String startLocalManagementAgent() {
+        return null;
+    }
+
+    public void startManagementAgent(Properties agentProperties) {
+    }
+
 }
diff --git a/test/com/sun/tools/attach/StartManagementAgent.java b/test/com/sun/tools/attach/StartManagementAgent.java
new file mode 100644
index 0000000..16e701e
--- /dev/null
+++ b/test/com/sun/tools/attach/StartManagementAgent.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2014 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 com.sun.tools.attach.AttachOperationFailedException;
+import com.sun.tools.attach.VirtualMachine;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Properties;
+import java.util.HashMap;
+
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+
+import jdk.testlibrary.ProcessThread;
+import jdk.testlibrary.Utils;
+
+/*
+ * @test
+ * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
+ * @library /lib/testlibrary
+ * @run build Application Shutdown SimpleProvider jdk.testlibrary.*
+ * @run main StartManagementAgent
+ */
+
+/*
+ * This test is not meant to test all possible configuration parameters to
+ * the JMX agent, there are other tests for that. This test makes sure it is
+ * possible to start the agent via attach.
+ */
+public class StartManagementAgent {
+    public static void main(String[] args) throws Throwable {
+        final String pidFile = "StartManagementAgent.Application.pid";
+        ProcessThread processThread = null;
+        RunnerUtil.ProcessInfo info = null;
+        try {
+            processThread = RunnerUtil.startApplication(pidFile);
+            info = RunnerUtil.readProcessInfo(pidFile);
+            runTests(info.pid);
+        } catch (Throwable t) {
+            System.out.println("StartManagementAgent got unexpected exception: " + t);
+            t.printStackTrace();
+            throw t;
+        } finally {
+            // Make sure the Application process is stopped.
+            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+        }
+    }
+
+    private static void basicTests(VirtualMachine vm) throws Exception {
+
+        // Try calling with null argument
+        boolean exception = false;
+        try {
+            vm.startManagementAgent(null);
+        } catch (NullPointerException e) {
+            exception = true;
+        }
+        if (!exception) {
+            throw new Exception("startManagementAgent(null) should throw NPE");
+        }
+
+        // Try calling with a property value with a space in it
+        Properties p = new Properties();
+        File f = new File("file with space");
+        try (FileWriter fw = new FileWriter(f)) {
+            fw.write("com.sun.management.jmxremote.port=apa");
+        }
+        p.put("com.sun.management.config.file", f.getAbsolutePath());
+        try {
+            vm.startManagementAgent(p);
+        } catch(AttachOperationFailedException ex) {
+            // We expect parsing of "apa" above to fail, but if the file path
+            // can't be read we get a different exception message
+            if (!ex.getMessage().contains("java.lang.NumberFormatException")) {
+                throw ex;
+            }
+        }
+    }
+
+    private static final String LOCAL_CONNECTOR_ADDRESS_PROP =
+        "com.sun.management.jmxremote.localConnectorAddress";
+
+    private static final int MAX_RETRIES = 10;
+
+    public static void runTests(int pid) throws Exception {
+        VirtualMachine vm = VirtualMachine.attach(""+pid);
+        try {
+
+            basicTests(vm);
+
+            testLocalAgent(vm);
+
+            // we retry the remote case several times in case the error
+            // was caused by a port conflict
+            int i = 0;
+            boolean success = false;
+            do {
+                try {
+                    System.err.println("Trying remote agent. Try #" + i);
+                    testRemoteAgent(vm);
+                    success = true;
+                } catch(Exception ex) {
+                    System.err.println("testRemoteAgent failed with exception:");
+                    ex.printStackTrace();
+                    System.err.println("Retrying.");
+                }
+                i++;
+            } while(!success && i < MAX_RETRIES);
+            if (!success) {
+                throw new Exception("testRemoteAgent failed after " + MAX_RETRIES + " tries");
+            }
+        } finally {
+            vm.detach();
+        }
+    }
+
+    public static void testLocalAgent(VirtualMachine vm) throws Exception {
+        Properties agentProps = vm.getAgentProperties();
+        String address = (String) agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
+        if (address != null) {
+            throw new Exception("Local management agent already started");
+        }
+
+        String result = vm.startLocalManagementAgent();
+
+        // try to parse the return value as a JMXServiceURL
+        new JMXServiceURL(result);
+
+        agentProps = vm.getAgentProperties();
+        address = (String) agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
+        if (address == null) {
+            throw new Exception("Local management agent could not be started");
+        }
+    }
+
+    public static void testRemoteAgent(VirtualMachine vm) throws Exception {
+        int port = Utils.getFreePort();
+
+        // try to connect - should fail
+        tryConnect(port, false);
+
+        // start agent
+        System.out.println("Starting agent on port: " + port);
+        Properties mgmtProps = new Properties();
+        mgmtProps.put("com.sun.management.jmxremote.port", port);
+        mgmtProps.put("com.sun.management.jmxremote.authenticate", "false");
+        mgmtProps.put("com.sun.management.jmxremote.ssl", "false");
+        vm.startManagementAgent(mgmtProps);
+
+        // try to connect - should work
+        tryConnect(port, true);
+
+        // try to start again - should fail
+        boolean exception = false;
+        try {
+            vm.startManagementAgent(mgmtProps);
+        } catch(AttachOperationFailedException ex) {
+            // expected
+            exception = true;
+        }
+        if (!exception) {
+            throw new Exception("Expected the second call to vm.startManagementAgent() to fail");
+        }
+    }
+
+    private static void tryConnect(int port, boolean shouldSucceed) throws Exception {
+        String jmxUrlStr =
+            String.format(
+                "service:jmx:rmi:///jndi/rmi://localhost:%d/jmxrmi",
+                port);
+        JMXServiceURL url = new JMXServiceURL(jmxUrlStr);
+        HashMap<String, ?> env = new HashMap<>();
+
+        boolean succeeded;
+        try {
+            JMXConnector c = JMXConnectorFactory.connect(url, env);
+            c.getMBeanServerConnection();
+            succeeded = true;
+        } catch(Exception ex) {
+            succeeded = false;
+        }
+        if (succeeded && !shouldSucceed) {
+            throw new Exception("Could connect to agent, but should not have been possible");
+        }
+        if (!succeeded && shouldSucceed) {
+            throw new Exception("Could not connect to agent");
+        }
+    }
+}
diff --git a/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java b/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
index 2439765..558b2da 100644
--- a/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
+++ b/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -143,9 +143,12 @@
                 String vmid = name.substring(0, name.indexOf("@"));
                 System.out.println("vmid = " + vmid);
                 VirtualMachine vm = VirtualMachine.attach(vmid);
-                String agent = vm.getSystemProperties().getProperty("java.home") +
-                        File.separator + "lib" + File.separator + "management-agent.jar";
-                vm.loadAgent(agent, "com.sun.management.jmxremote.port=0,com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl=false");
+                Properties p = new Properties();
+                p.put("com.sun.management.jmxremote.port", "0");
+                p.put("com.sun.management.jmxremote.authenticate", "false");
+                p.put("com.sun.management.jmxremote.ssl", "false");
+                vm.startManagementAgent(p);
+                vm.startLocalManagementAgent();
                 vm.detach();
                 String localAddress2 = ConnectorAddressLink.importFrom(0);
                 if (localAddress2 == null) {
diff --git a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
index 6eecbda..54173e6 100644
--- a/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
+++ b/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -79,16 +79,6 @@
         return doTest("1", "-Dcom.sun.management.jmxremote");
     }
 
-    private static boolean test2() throws Exception {
-        Path agentPath = findAgent();
-        if (agentPath != null) {
-            String agent = agentPath.toString();
-            return doTest("2", "-javaagent:" + agent);
-        } else {
-            return false;
-        }
-    }
-
     /**
      * no args (blank) - manager should attach and start agent
      */
@@ -97,68 +87,12 @@
     }
 
     /**
-     * sanity check arguments to management-agent.jar
-     */
-    private static boolean test4() throws Exception {
-        Path agentPath = findAgent();
-        if (agentPath != null) {
-            ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(
-                "-javaagent:" + agentPath.toString() +
-                "=com.sun.management.jmxremote.port=7775," +
-                "com.sun.management.jmxremote.authenticate=false," +
-                "com.sun.management.jmxremote.ssl=false",
-                "-cp",
-                TEST_CLASSPATH,
-                "TestApplication",
-                "-exit"
-            );
-
-            Process prc = null;
-            try {
-                prc = ProcessTools.startProcess(
-                    "TestApplication",
-                    builder
-                );
-                int exitCode = prc.waitFor();
-                return exitCode == 0;
-            } finally {
-                if (prc != null) {
-                    prc.destroy();
-                    prc.waitFor();
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
      * use DNS-only name service
      */
     private static boolean test5() throws Exception {
         return doTest("5", "-Dsun.net.spi.namservice.provider.1=\"dns,sun\"");
     }
 
-    private static Path findAgent() {
-        FileSystem FS = FileSystems.getDefault();
-        Path agentPath = FS.getPath(
-            TEST_JDK, "jre", "lib", "management-agent.jar"
-        );
-        if (!isFileOk(agentPath)) {
-            agentPath = FS.getPath(
-                TEST_JDK, "lib", "management-agent.jar"
-            );
-        }
-        if (!isFileOk(agentPath)) {
-            System.err.println("Can not locate management-agent.jar");
-            return null;
-        }
-        return agentPath;
-    }
-
-    private static boolean isFileOk(Path path) {
-        return Files.isRegularFile(path) && Files.isReadable(path);
-    }
-
     private static boolean doTest(String testId, String arg) throws Exception {
         List<String> args = new ArrayList<>();
         args.add("-cp");
diff --git a/test/sun/management/jmxremote/bootstrap/TestManager.java b/test/sun/management/jmxremote/bootstrap/TestManager.java
index 4495c2d..76b4324 100644
--- a/test/sun/management/jmxremote/bootstrap/TestManager.java
+++ b/test/sun/management/jmxremote/bootstrap/TestManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -40,7 +40,6 @@
 import static java.lang.management.ManagementFactory.*;
 import java.net.Socket;
 import java.net.InetSocketAddress;
-import java.io.File;
 import java.io.IOException;
 
 // Sun specific
@@ -55,28 +54,8 @@
      * Starts the management agent in the target VM
      */
     private static void startManagementAgent(String pid) throws IOException {
-        /*
-         * JAR file normally in ${java.home}/jre/lib but may be in ${java.home}/lib
-         * with development/non-images builds
-         */
-        String home = System.getProperty("java.home");
-        String agent = home + File.separator + "jre" + File.separator + "lib"
-                + File.separator + "management-agent.jar";
-        File f = new File(agent);
-        if (!f.exists()) {
-            agent = home + File.separator + "lib" + File.separator +
-                "management-agent.jar";
-            f = new File(agent);
-            if (!f.exists()) {
-                throw new RuntimeException("management-agent.jar missing");
-            }
-        }
-        agent = f.getCanonicalPath();
-
-        System.out.println("Loading " + agent + " into target VM ...");
-
         try {
-            VirtualMachine.attach(pid).loadAgent(agent);
+            VirtualMachine.attach(pid).startLocalManagementAgent();
         } catch (Exception x) {
             throw new IOException(x.getMessage());
         }
@@ -122,8 +101,7 @@
 
         if (agentPropLocalConnectorAddress == null &&
             jvmstatLocalConnectorAddress == null) {
-            // No JMX Connector address so attach to VM, and load
-            // management-agent.jar
+            // No JMX Connector address so attach to VM, and start local agent
             startManagementAgent(pid);
             agentPropLocalConnectorAddress = (String)
                 vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP);
diff --git a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
index cacb708..d937244 100644
--- a/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
+++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -31,16 +31,13 @@
 import java.rmi.registry.Registry;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
 
 import javax.management.*;
@@ -60,7 +57,6 @@
  *          JCMD achieves the desired results
  */
 public class JMXStartStopTest {
-    private static final String TEST_JDK = System.getProperty("test.jdk");
     private static final String TEST_SRC = System.getProperty("test.src");
 
     private static final boolean verbose = false;
@@ -76,8 +72,8 @@
                                   QueryExp query)
     throws Exception {
 
-        Set names = server.queryNames(pattern,query);
-        for (Iterator i=names.iterator(); i.hasNext(); ) {
+        Set<ObjectName> names = server.queryNames(pattern,query);
+        for (Iterator<ObjectName> i = names.iterator(); i.hasNext(); ) {
             ObjectName name = (ObjectName)i.next();
             MBeanInfo info = server.getMBeanInfo(name);
             dbg_print("Got MBean: " + name);
@@ -87,7 +83,7 @@
                 continue;
             for (MBeanAttributeInfo attr : attrs) {
                 if (attr.isReadable()) {
-                    Object o = server.getAttribute(name, attr.getName());
+                    server.getAttribute(name, attr.getName());
                 }
             }
         }
@@ -108,9 +104,8 @@
             }
 
             JMXServiceURL url = new JMXServiceURL(jmxUrlStr);
-            Map m = new HashMap();
 
-            JMXConnector c = JMXConnectorFactory.connect(url,m);
+            JMXConnector c = JMXConnectorFactory.connect(url, null);
 
             MBeanServerConnection conn = c.getMBeanServerConnection();
             ObjectName pattern = new ObjectName("java.lang:type=Memory,*");
@@ -180,9 +175,8 @@
                 port);
 
         JMXServiceURL url = new JMXServiceURL(jmxUrlStr);
-        Map m = new HashMap();
 
-        JMXConnector c = JMXConnectorFactory.connect(url,m);
+        JMXConnector c = JMXConnectorFactory.connect(url, null);
 
         MBeanServerConnection conn = c.getMBeanServerConnection();
         ObjectName pattern = new ObjectName("java.lang:type=Memory,*");
@@ -273,25 +267,6 @@
         }
     }
 
-    /**
-     * Retrieves the PID of the test application using JCMD
-     * @return The PID of the test application
-     * @throws InterruptedException
-     * @throws IOException
-     */
-    private static String getPID() throws InterruptedException, IOException {
-        final AtomicReference<String> pid = new AtomicReference<>();
-        jcmd(
-            null,
-            line -> {
-                if (line.endsWith("JMXStartStopDoSomething")) {
-                    pid.set(line.split(" ")[0]);
-                }
-            }
-        );
-        return pid.get();
-    }
-
     private static class Something {
         private Process p;
         private final ProcessBuilder pb;
@@ -434,7 +409,7 @@
     private static final int port1 = 50234;
     private static final int port2 = 50235;
 
-    private static void test_01() throws Exception {
+    static void test_01() throws Exception {
         // Run an app with JMX enabled stop it and
         // restart on other port
 
@@ -459,7 +434,7 @@
         }
     }
 
-    private static void test_02() throws Exception {
+    static void test_02() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd
 
@@ -478,7 +453,7 @@
         }
     }
 
-    private static void test_03() throws Exception {
+    static void test_03() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd on one port than on other one
 
@@ -507,7 +482,7 @@
         }
     }
 
-    private static void test_04() throws Exception {
+    static void test_04() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd on one port, specify rmi port explicitly
 
@@ -528,7 +503,7 @@
         }
     }
 
-    private static void test_05() throws Exception {
+    static void test_05() throws Exception {
         // Run an app without JMX enabled, it will enable local server
         // but should leave remote server disabled
 
@@ -545,7 +520,7 @@
         }
     }
 
-    private static void test_06() throws Exception {
+    static void test_06() throws Exception {
         // Run an app without JMX enabled
         // start JMX by jcmd on one port, specify rmi port explicitly
         // attempt to start it again
@@ -569,7 +544,7 @@
             final boolean[] checks = new boolean[3];
             jcmd(
                 line -> {
-                    if (line.equals("java.lang.RuntimeException: Invalid agent state")) {
+                    if (line.contains("java.lang.RuntimeException: Invalid agent state")) {
                         checks[0] = true;
                     }
                 },
@@ -580,7 +555,7 @@
 
             jcmd(
                 line -> {
-                    if (line.equals("java.lang.RuntimeException: Invalid agent state")) {
+                    if (line.contains("java.lang.RuntimeException: Invalid agent state")) {
                         checks[1] = true;
                     }
                 },
@@ -648,7 +623,7 @@
         }
     }
 
-    private static void test_08() throws Exception {
+    static void test_08() throws Exception {
         // Run an app with JMX enabled and with some properties set
         // in command line.
         // stop JMX agent and then start it again with different property values
@@ -682,7 +657,7 @@
         }
     }
 
-    private static void test_09() throws Exception {
+    static void test_09() throws Exception {
         // Run an app with JMX enabled and with some properties set
         // in command line.
         // stop JMX agent and then start it again with different property values
@@ -718,7 +693,7 @@
         }
     }
 
-    private static void test_10() throws Exception {
+    static void test_10() throws Exception {
         // Run an app with JMX enabled and with some properties set
         // in command line.
         // stop JMX agent and then start it again with different property values
@@ -754,7 +729,7 @@
         }
     }
 
-    private static void test_11() throws Exception {
+    static void test_11() throws Exception {
         // Run an app with JMX enabled
         // stop remote agent
         // make sure local agent is not affected
@@ -775,7 +750,7 @@
         }
     }
 
-    private static void test_12() throws Exception {
+    static void test_12() throws Exception {
         // Run an app with JMX disabled
         // start local agent only
 
@@ -793,28 +768,4 @@
             s.stop();
         }
     }
-
-    private static void test_13() throws Exception {
-        // Run an app with -javaagent make sure it works as expected -
-        // system properties are ignored
-
-        System.out.println("**** Test thirteen ****");
-
-        String agent = TEST_JDK + "/jre/lib/management-agent.jar";
-        if (!new File(agent).exists()) {
-            agent = TEST_JDK + "/lib/management-agent.jar";
-        }
-
-        Something s = doSomething("test_14",
-            "-javaagent:" + agent + "=com.sun.management.jmxremote.port=" +
-                port1 + ",com.sun.management.jmxremote.authenticate=false",
-            "-Dcom.sun.management.jmxremote.ssl=false"
-        );
-
-        try {
-            testNoConnect(port1);
-        } finally {
-            s.stop();
-        }
-    }
 }
