public static String reducePath(String path) {
        if (path == null || path.indexOf("./") == -1) {
            return path;
        }
        String[] parts = path.split("/");
        LinkedList<String> list = new LinkedList<>();
        for (int i = 0; i < parts.length; i++) {
            String string = parts[i];
            if (string.length() == 0 || string.equals(".")) {
                //do nothing
            } else if (string.equals("..")) {
                if (list.size() > 0 && !list.getLast().equals("..")) {
                    list.removeLast();
                } else {
                    list.add("..");
                    Logger.getLogger(AssetKey.class.getName())
                            .log(Level.SEVERE, "Asset path \"{0}\" is outside the asset manager root", path);
                }
            } else {
                list.add(string);
            }
        }
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            String string = list.get(i);
            if (i != 0) {
                builder.append("/");
            }
            builder.append(string);
        }
        return builder.toString();
    }
Removes all relative elements of a path (A/B/../C.png and A/./C.png).
@param path The path containing relative elements
@return A path without relative elements
jme3-core/src/main/java/com/jme3/asset/AssetKey.java