Convert a classfile path to the corresponding class name.

@param classfilePath
the classfile path
@return the class name
963041
public static String classfilePathToClassName(final String classfilePath) {
        if (!classfilePath.endsWith(".class")) {
            throw new IllegalArgumentException("Classfile path does not end with \".class\": " + classfilePath);
        }
        return classfilePath.substring(0, classfilePath.length() - 6).replace('/', '.');
    }
1284909
public int submitFilePathOrClasspath(
            String filePathOrResourceClasspath) {
        return submitStream(JMOptional
                .getOptional(JMFiles.readLines(filePathOrResourceClasspath))
                .orElseGet(() -> JMResources
                        .readLines(filePathOrResourceClasspath)).stream());
    }
1328652
private void handleAuxClassPathFromFile(String filePath) throws IOException {
        try (BufferedReader in = new BufferedReader(UTF8.fileReader(filePath))) {
            while (true) {
                String s = in.readLine();
                if (s == null) {
                    break;
                }
                project.addAuxClasspathEntry(s);
            }
        }
    }
633023
public static <T> T withFilePathOrClasspath(
            String resourceFilePathOrClasspath,
            TypeReference<T> typeReference) {
        return withJsonString(JMResources
                        .getStringWithFilePathOrClasspath(resourceFilePathOrClasspath),
                typeReference);
    }
300261
static String getClassPathName(Class<?> c) {
		String strClassFullName = c.getName();

		StringTokenizer st = new StringTokenizer(strClassFullName, ".");
		StringBuffer sb = new StringBuffer();
		sb.append(st.nextToken());

		while (st.hasMoreTokens()) {
			sb.append("/");
			sb.append(st.nextToken());
		}

		sb.append(".class");
		return sb.toString();
	}
680204
@SuppressWarnings({ "resource" })
	public static void showClasspath() {
		final String cp = getCurrentClasspath();
		if (!Strings.isNullOrEmpty(cp)) {
			final PrintStream ps = getConsoleLogger();
			for (final String entry : cp.split(Pattern.quote(File.pathSeparator))) {
				ps.println(entry);
			}
			ps.flush();
		}
		getExiter().exit();
	}
787351
static String[] getClasspathClassNames() throws ZipException, IOException {
        final String[] classes = getClasspathFileNamesWithExtension(".class");
        for (int i = 0; i < classes.length; i++) {
            classes[i] = classes[i].substring(0, classes[i].length() - 6).replace("/", ".");
        }
        return classes;
    }
1117
public void setClasspath(String classpath) {
        this.classpath = new LinkedList<String>();
        StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
        while (tokenizer.hasMoreTokens()) {
            this.classpath.add(tokenizer.nextToken());
        }
    }
207956
public static function getFullClassName(File $classFile, Dir $classPath = NULL) {
    $classPath = $classPath ?: self::getProject()->getClassPath()->up();
  
    try {
      $parts = $classFile->getDirectory()->makeRelativeTo($classPath)->getPathArray();
    } catch (\Webforge\Common\System\Exception $e) {
      throw new Exception('ClassFile: "'.$classFile.'" liegt nicht im Verzeichnis: "'.$classPath.'"!',0,$e);
    }
    array_shift($parts); // den . entfernen
    $parts[] = $classFile->getName(File::WITHOUT_EXTENSION);
    
    $className = '\\'.implode('\\',$parts);
    return $className;
  }
1104924
private static File determineClassName( File original ) throws IOException {
		String text = FileUtils.readFileToString(original, "UTF-8");

		if(!text.contains("//CONCURRENT"))
			throw new IOException("Not a concurrent file");

		String pattern = "//CONCURRENT_CLASS_NAME ";
		int where = text.indexOf(pattern);
		if( where < 0 ) {
			String name = className(original);
			return new File(original.getParent(),name+"_MT.java");
		}

		String name = readUntilEndOfLine(text,where+pattern.length());
		return new File(original.getParent(),name+".java");
	}
612401
public static String getAbsolutePath(String path, Class<?> baseClass) {
		String normalPath;
		if (path == null) {
			normalPath = StrUtil.EMPTY;
		} else {
			normalPath = normalize(path);
			if (isAbsolutePath(normalPath)) {
				// 给定的路径已经是绝对路径了
				return normalPath;
			}
		}

		// 相对于ClassPath路径
		final URL url = ResourceUtil.getResource(normalPath, baseClass);
		if (null != url) {
			// 对于jar中文件包含file:前缀，需要去掉此类前缀，在此做标准化，since 3.0.8 解决中文或空格路径被编码的问题
			return FileUtil.normalize(URLUtil.getDecodedPath(url));
		}

		// 如果资源不存在，则返回一个拼接的资源绝对路径
		final String classPath = ClassUtil.getClassPath();
		if (null == classPath) {
			// throw new NullPointerException("ClassPath is null !");
			// 在jar运行模式中，ClassPath有可能获取不到，此时返回原始相对路径（此时获取的文件为相对工作目录）
			return path;
		}

		// 资源不存在的情况下使用标准化路径有问题，使用原始路径拼接后标准化路径
		return normalize(classPath.concat(path));
	}
587389
public void setClasspath(Path classpath) {
        if (taskClasspath == null) {
            taskClasspath = classpath;
        }
        else {
            taskClasspath.append(classpath);
        }
    }
1051446
public ClassLoader resolve(Iterable<? extends File> classPath) {
        Set<File> classPathList = new LinkedHashSet<File>();
        for (File file : classPath) {
            classPathList.add(file);
        }
        return resolve(classPathList);
    }
810460
private static InputStream findFileInClasspath(String fileName) {

		InputStream is = null;

		try {

			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
			is = classLoader.getResourceAsStream(fileName);
			return is;

		} catch (Exception ex) {

			log.error(String.format("Error while reading file '%s' from classpath", fileName), ex);
			return null;
		}

	}
89238
public static String pathToPackageName(String relativePath)
    {
        String qualifiedName = classFilePathToClassname(relativePath);
        return ClassNameUtil.getPackageName(qualifiedName);
    }
754000
private static InputStream getStreamFromClasspath(String fileName)
    {
        String path = fileName;
        InputStream dtdStream = PersistenceXMLLoader.class.getClassLoader().getResourceAsStream(path);
        return dtdStream;
    }
1327478
private String extractClassName(URL classURL) {
        String path = classURL.getPath();
        return path
            .replaceAll("^/", "")
            .replaceAll(".class$", "")
            .replaceAll("\\/", ".");
    }