javax.activation
import javax.activation.*;
public class GetMimeType {
public static void main(String[] args) {
try {
// Create an ActivationDataFlavor with the file's MIME type
ActivationDataFlavor flavor = new ActivationDataFlavor(MimetypesFileTypeMap.getDefaultFileTypeMap());
// Get the file's MIME type from the data flavor
String mimeType = flavor.getMimeType();
System.out.println("MIME type: " + mimeType);
} catch (Exception e) {
e.printStackTrace();
}
}
}