title: Java get file type from content using mimeutil is not working as expected
body: <p>In my following code:</p>
  
  <pre><code>MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
  File f = new File ("c:\\temp\\mime\\java.exe");
  Collection&lt;?&gt; mimeTypes = MimeUtil.getMimeTypes("c:\\temp\\mime\\java.exe");
  MimeType m = mimeTypes.toArray(new MimeType[mimeTypes.size()])[0];
  System.out.println(m);
  </code></pre>
  
  <p>The output is always application/octet-stream no matter what file type is chosen ie csv, xls, exe, etc.</p>
  
  <p>But according to the following site:</p>
  
  <p><a href="http://www.rgagnon.com/javadetails/java-0487.html" rel="nofollow">http://www.rgagnon.com/javadetails/java-0487.html</a></p>
  
  <p>it should show as like ms-word or ms-excel etc.</p>
  
  <p>How to make this work? All I want is just get the file type from file content(not by using file extension which is not very reliable). I was reading about other options like tika which requires too many files (like 20) which is too much for this single purpose and JMimeMagic which requires apache-oro which is a dead project hence I don't like the idea either. All other solutions seem to rely on file extension which seem not to be reliable as mentioned above.</p>
  
  <p>Thanks</p>