Here you can find the source of getFileWithoutExtension(File file)
public static File getFileWithoutExtension(File file)
//package com.java2s; import java.io.File; public class Main { public static File getFileWithoutExtension(File file) { return getFileWithOtherExtension(file, ""); }// w ww . j ava 2s. c o m public static File getFileWithOtherExtension(File file, String newExtension) { String name = file.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot < 0) { lastDot = name.length(); } return new File(file.getParent(), name.substring(0, lastDot) + newExtension); } }