Java tutorial
//package com.java2s; import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String getFilePath(File dirPath, String fileName) { try { String filePath = dirPath.getAbsolutePath() + File.separator + URLEncoder.encode(fileName.replace("*", ""), "UTF-8"); return filePath; } catch (final UnsupportedEncodingException e) { e.printStackTrace(); } return null; } }