Java Path Convert To filePathToClassPath(String path)

Here you can find the source of filePathToClassPath(String path)

Description

file Path To Class Path

License

Apache License

Declaration

private static String filePathToClassPath(String path) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static String filePathToClassPath(String path) {
        path = toForwardSlashes(path);/*from w  w  w  .  j av  a 2 s .  c  o  m*/
        if (path.charAt(0) == '/') {
            path = path.substring(1);
        }
        return path.replace('/', '.');
    }

    public static String toForwardSlashes(String path) {
        if (path == null) {
            return null;
        }
        return path.replace('\\', '/');
    }
}

Related

  1. filePathToClassNameOrNull(String filePathWithExtension)
  2. filePathToJavaBinaryName(final String filePath, final String separator)
  3. filePathToPackagePathOrNull(String path)
  4. filePathToUrl(String filePath)
  5. pathTo(String filename)