Skip to content
Work around broken JDK7 FileTypeDetector on Mac OSX
Java
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main
LICENSE
README.md
mime.types
pom.xml

README.md

Why this project

JDK7 uses sun.nio.fs.GnomeFileTypeDetector as the default filetype detector on mac OSX. However this implementation is buggy and won't detect anything, even if libgio is actually available on the system. This project is a dirty backports of JDK8's MimeTypesFileTypeDetector which defaults to ${user.home}/.mime.types for mime types mapping and is not customisable at runtime.

How to use

Run maven clean package and make sure it is on the classpath of your app (I drop the resulting jar in my $JAVA_HOME/jre/lib/ext folder to avoid polluting the project itself). The jar will automatically register the backported file type detector. Make sure you have an existing ~/.mime.types, if necessary create one from the file at the root of this project.

You can’t perform that action at this time.