Java Utililty Methods ClassLoader Load

List of utility methods to do ClassLoader Load

Description

The list of methods to do ClassLoader Load are organized into topic(s).

Method

StringgetSystemPath(String inPath)
get System Path
return getUrl(inPath).toString().replace(getUrl(inPath).getProtocol() + ":/", "");
FilegetTestDir(final String name)
get Test Dir
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
URL resource = cloader.getResource(name);
if (resource == null) {
    throw new IOException("Cannot find test directory: " + name);
return new File(new URI(resource.toExternalForm()).normalize().getPath());
StringgetTestJson()
get Test Json
try {
    URL url = Thread.currentThread().getContextClassLoader().getResource("model.json");
    File file = new File(url.getPath());
    return readFile(file);
} catch (IOException ex) {
    throw new RuntimeException("Unable to load test file : " + ex.getMessage());
URLgetTomcatBinaryDistribution()
Returns URL to get Tomcat binary distribution.
URL tomcatDistributionUrl = Thread.currentThread().getContextClassLoader().getResource("sdk-tomcat.zip");
if (tomcatDistributionUrl == null) {
    throw new IOException("Unable to get Tomcat binary distribution.");
return tomcatDistributionUrl;
FilegetVolFile(String fileName)
get Vol File
URL validURL = ClassLoader.getSystemResource(fileName);
return new File(validURL.toURI());