Java Class Path Create getClasspathURL(final String name)

Here you can find the source of getClasspathURL(final String name)

Description

Gets the class path of a resource.

License

Open Source License

Parameter

Parameter Description
name Name of resource

Return

The URL of the resource

Declaration

public static URL getClasspathURL(final String name) 

Method Source Code

//package com.java2s;
/*  Copyright 2010 Ben Ruijl, Wouter Smeenk
    //w ww  . ja v  a2s  .c om
This file is part of Walled In.
    
Walled In 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, or (at your option)
any later version.
    
Walled In 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 Walled In; see the file LICENSE.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
    
 */

import java.net.URL;

public class Main {
    /**
     * Gets the class path of a resource.
     * 
     * @param name
     *            Name of resource
     * @return The <code>URL</code> of the resource
     */
    public static URL getClasspathURL(final String name) {
        return ClassLoader.getSystemResource(name);
    }
}

Related

  1. getClassBasePath(URL classUrl, Class clazz)
  2. getClassPathArchiveContents(final URL resource)
  3. getClasspathResourceURL(String resourceName)
  4. getClasspathUrl(final Class aClass, final String aPath)
  5. getClasspathURLs(String classpath)