Java ClassPath Get getClassPathFromString(String classpath)

Here you can find the source of getClassPathFromString(String classpath)

Description

get Class Path From String

License

Open Source License

Declaration

public static HashSet<URL> getClassPathFromString(String classpath) 

Method Source Code

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

import java.io.File;

import java.net.MalformedURLException;
import java.net.URL;

import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    public static HashSet<URL> getClassPathFromString(String classpath) {
        HashSet<URL> cpurls = new HashSet<URL>();
        // Create a set of classpath URLs to be used later
        StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator);
        while (st.hasMoreTokens()) {
            try {
                cpurls.add(new File(st.nextToken()).toURI().toURL());
            } catch (MalformedURLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();//from  w ww .  j av a 2 s .c  om
                System.exit(-1);
            }
        }
        return cpurls;
    }
}

Related

  1. getClasspathFile(String fn)
  2. getClassPathFile(String pathName)
  3. getClasspathFilePathFromName(String fileName)
  4. getClassPathFor(final Class clazz)
  5. getClasspathForClass(Class targetClass)
  6. getClassPathPath()
  7. getClasspathResource(final String resource)
  8. getClasspathResource(String name)
  9. getClasspathResource(String path)