Here you can find the source of getFileNameWithoutExtension(final String filePath)
public static String getFileNameWithoutExtension(final String filePath)
//package com.java2s; import java.io.File; public class Main { /**// www . jav a2 s. c o m * returns file name "/tmp/abc.txt" returns "abc" */ public static String getFileNameWithoutExtension(final String filePath) { final File file = new File(filePath); String fileName = file.getName(); fileName = fileName.replace(" ", "_"); final int index = fileName.lastIndexOf('.'); return fileName.substring(0, index); } }