Java Bug on MacOS

While using the Mayocat, I have encountered that the theme page cannot load css and js correctly. The browser said that it did not parse the css and js file due to some CSS MIME and strict mode error. Then after checking the response header, I found the reason which was the header “Content-type” was set to “octet-stream”, which was supposed to be “text/css” or “application/javascript”.

After searching through repository of Mayocat, I found this:

Mayocat Bug

And then followed the link, and found this:

Oracle Bug

And then I found out that this bug was cause by JDK7, package java.nio.file, method probeContentType(Path path) and this feature was broken on Mac OS X (More details here).

However, this bug should be fixed in JDK8, mine was still not working although my working environment was under JDK8. Then I checked the Oracle Bug Database and it seems that it need a file .mime.types(you can download one sample file here or simply get it from your apache server or nginx server) in $HOME/ directory.

After adding the file .mime.types to ~/ (remember to clear the browser cache!), everything was ok then :).