Saturday, February 17, 2007

JDK 6 RPM messed up with zip mimetype

I installed JDK 6 RPM from Sun's Java SE download page for my Object Oriented Programming course. After installation, I was annoyed by all of my zipfiles and files that uses zip format to be identified as x-java-archive. This change created an annoying "Warning wrong filetype" when opening files that uses zip format but uses different extension - like ODF files. And when I select those files, their icons also changed to java-archive icons.

Being greatly annoyed, I started hunting down the mime-type definition. First, I tried to find the definition by grepping x-java-archive from the jdk rpm
# rpm -ql jdk|grep x-java-archive|grep -v icons
/usr/java/jdk1.6.0/jre/lib/desktop/mime/packages/x-java-archive.xml
Bingo!. Found it.

I fired up vi and edited the definition file and commented out the <magic> tag
<!-- <magic priority="85">
<match type="string" value="PK\003\004" offset="0">
match type="host16" value="0xcafe" offset="40" />
</match>
</magic> -->

Juz to be sure , I tried to locate other x-java-archive definitions and commented out their <magic> tags

# updatedb 
# locate x-java-archive.xml
/usr/java/jdk1.6.0/jre/lib/desktop/mime/packages/x-java-archive.xml
/usr/share/mime/application/x-java-archive.xml
/usr/share/mime/packages/x-java-archive.xml

After editing them, the mime cache need to be updated for things to take effect immediately.
cd /usr/share/mime/
update-mime-database /usr/share/mime/

Finally, relogin to gnome for applying the changes.

Yeah~!, no longer annoying "Warning wrong filetype" messages when double-clicking ODF files and others that uses zip format.
Post a Comment