How to get a file’s Media Type (MIME type)? September 23, 2022 by Tarik In Java 7 you can now just use Files.probeContentType(path).