Example usage for java.lang.management RuntimeMXBean isBootClassPathSupported

List of usage examples for java.lang.management RuntimeMXBean isBootClassPathSupported

Introduction

In this page you can find the example usage for java.lang.management RuntimeMXBean isBootClassPathSupported.

Prototype

public boolean isBootClassPathSupported();

Source Link

Document

Tests if the Java virtual machine supports the boot class path mechanism used by the bootstrap class loader to search for class files.

Usage

From source file:org.pepstock.jem.util.ReverseURLClassLoader.java

/**
 * Loads all JARS of the bootstrap classpath. If JRE/jDK doesn't support bootstrap, could create 
 * issues. Uses java.management to get these information
 *//*  ww w  . j  a va  2  s. c o m*/
private void loadBootstrapFiles() {
    // 
    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
    // checks if bootstrap classpath is supporte
    if (runtime.isBootClassPathSupported()) {
        // gets all files
        String longFiles = ManagementFactory.getRuntimeMXBean().getBootClassPath();
        // splits by path separator
        String[] files = StringUtils.split(longFiles, File.pathSeparator);
        // reads all JAR files
        for (int i = 0; i < files.length; i++) {
            try {
                JarFile jFile = new JarFile(files[i]);
                bootstrap.add(jFile);
            } catch (IOException e) {
                LogAppl.getInstance().ignore(e.getMessage(), e);
            }
        }
    }
}