Java ClassPath printJVMClassPath()

Here you can find the source of printJVMClassPath()

Description

print JVM Class Path

License

Open Source License

Declaration

public static void printJVMClassPath() 

Method Source Code

//package com.java2s;
/* Copyright 2012, 2013 Unconventional Thinking
 *
 * This file is part of Hierarchy./* ww w.  j ava  2s . c o m*/
 *
 * Hierarchy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * Hierarchy 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 for more details.
 *
 * You should have received a copy of the GNU General Public License along with Hierarchy.  
 * If not, see <http://www.gnu.org/licenses/>.
 */

import java.net.URL;
import java.net.URLClassLoader;

public class Main {
    public static void printJVMClassPath() {
        //Get the System Classloader
        ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();
        //Get the URLs
        URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
        for (int i = 0; i < urls.length; i++)
            System.out.println("   - " + urls[i].getFile());
    }
}

Related

  1. loadResourceFromClasspath(Class clazz, String resourceName)
  2. parseClassPath(String classpath)
  3. parseJavaClassPath()
  4. printClassPath()
  5. printClassPath(boolean single)
  6. readFileFromClasspath(String fileName)
  7. readFromClassPath(String filePath)
  8. readStringFromClasspath(String path, Class c)
  9. toClassLoaderWithDefaultParent(Collection classPaths)