Here you can find the source of getFileName(String relativePath)
public static String getFileName(String relativePath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static String getFileName(String relativePath) throws IOException { Path path = Paths.get(relativePath); return path.getFileName().toFile().getName(); }/*from ww w .ja v a 2s .c o m*/ }