public void detachAgent(Object pVm) {
        try {
            if (pVm != null) {
                Class clazz = pVm.getClass();
                Method method = clazz.getMethod("detach");
                method.setAccessible(true); // on J9 you get IllegalAccessException otherwise.
                method.invoke(pVm);
            }
        } catch (InvocationTargetException e) {
            throw new ProcessingException("Error while detaching",e, options);
        } catch (NoSuchMethodException e) {
            throw new ProcessingException("Error while detaching",e, options);
        } catch (IllegalAccessException e) {
            throw new ProcessingException("Error while detaching",e, options);
        }
    }
public void detachAgent ( Object pVm ) { try { if ( pVm != null ) { Class clazz = pVm . getClass ( ) ; Method method = clazz . getMethod ( "detach" ) ; method . setAccessible ( true ) ; method . invoke ( pVm ) ; } } catch ( InvocationTargetException e ) { throw new ProcessingException ( "Error while detaching" , e , options ) ; } catch ( NoSuchMethodException e ) { throw new ProcessingException ( "Error while detaching" , e , options ) ; } catch ( IllegalAccessException e ) { throw new ProcessingException ( "Error while detaching" , e , options ) ; } }
Detach from the virtual machine

@param pVm the virtual machine to detach from