Java ClassLoader Load getRootPath()

Here you can find the source of getRootPath()

Description

get Root Path

License

Open Source License

Declaration

public static String getRootPath() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.net.URL;

public class Main {
    public static String ROOT_PATH = null;

    public static String getRootPath() {
        if (null != ROOT_PATH) {
            return ROOT_PATH;
        }/*from w ww .  j a v a2  s  . c  o  m*/
        ClassLoader classLoader = Thread.currentThread()
                .getContextClassLoader();
        if (null == classLoader) {
            classLoader = ClassLoader.getSystemClassLoader();
        }
        URL url = classLoader.getResource("/");
        ROOT_PATH = new File(new File(url.getPath() + "/").getParent()
                + "/").getParent()
                + "/";

        return ROOT_PATH;
    }
}

Related

  1. getPath(String resoureLocation)
  2. getProhibitedProxyInterfaces()
  3. getProperties(String bundleName, String fileName)
  4. getProperty(String propertyName)
  5. getReader(final String name, final String encoding)
  6. getSimpleName(String fqcn)
  7. getSourcesPath()
  8. getSSTable(String version, int generation)
  9. getStream(final File file)