"file1.txt".replaceFirst("[.][^.]+$", "");
String fname = file.getName(); int pos = fname.lastIndexOf("."); if (pos > 0) { fname = fname.substring(0, pos); }
FilenameUtils.removeExtension(fileNameWithExt);