All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.catchpoint.trace.jdk.attach.JDKAttachSupport Maven / Gradle / Ivy

package com.catchpoint.trace.jdk.attach;

import java.io.File;

/**
 * Support class for providing JDK's Attach API related stuff.
 *
 * @author serkan
 */
public final class JDKAttachSupport {

    private JDKAttachSupport() {
    }

    /**
     * Checks whether JDK's Attach API related classes are provided
     * by JDK (if it is JDK instead of JRE).
     *
     * @return true if Attach API related classes are provided
     *         false otherwise
     */
    public static boolean areAttachAPIRelatedClassesProvidedByJDK() {
        String name = "com.sun.tools.attach.VirtualMachine";
        try {
            Class.forName(name);
            return true;
        } catch (Exception e) {
            String toolsPath = System.getProperty("java.home").replace('\\', '/') + "/../lib/tools.jar";
            return new File(toolsPath).exists();
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy