A simple workaround is to rename the omni.ja file extension to .zip and Windows will be able to open and extract the files. They can then modify the files according to their needs, repack them into a ZIP file, and finally rename back the file extension to .ja. Although this method works, it is not recommended due to additional optimization being done on the original omni.ja file which can yield an additional 2-3x reduction in disk I/O.
The optimized omni.ja file is not a standard ZIP format because the layout has been changed. Usually the index is placed at the end of the file, but an optimized omni.ja places the index at the front of the file to minimize disk seeks and to maximize read ahead benefits. This is the reason why some picky archiver programs such as the older version of 7-Zip 9.20 are unable to open omni.ja even though it is a ZIP file. Running a “test archive” function in 7-Zip will show that it detected error in headers.
Fortunately the author of 7-Zip has added the support to open the optimized omni.ja file in the latest version. While you have no problems opening omni.ja with the latest 7-Zip, it is not possible to automatically update the edited files. As you can see from the screenshot below, we tried editing a file from the omni.ja and 7-Zip throws an error saying that it is read-only when it tries to update the edited file in the archive.
Now we’ll show you how to deoptimize the optimized omni.ja file so that you can conveniently edit any files directly from 7-Zip and then reoptimize it so you don’t lose the additional 2-3x reduction in disk I/O.
1. Download ActivePython and install. If you’re running a 64-bit version of Windows, make sure to download the x64 version of ActivePython.
2. Download the updated optimizejars.py python script that has been fixed to work with omni.ja
3. For simplicity, place both omni.jar file and optimizejars.py file on your desktop. Run Command Prompt by pressing the Start button, type cmd and press Enter key. Change the directory to your desktop by typing “cd desktop”, hit Enter and type the command below to deoptimize the omni.ja file.
optimizejars.py --deoptimize ./ ./ ./
Alternatively, you can also copy the optimizejars.py file into the directory where omni.ja resides which is usually at C:\Program Files\Mozilla Firefox\, then run the command prompt as administrator, change the directory to the path where omni.ja is located and run the deoptimize command shown above. If you get an permission denied IOError 13 after running the deoptimize command, that means the command prompt is not run as administrator.
After a successful deoptimization, the omni.ja file becomes a standard ZIP file which can be opened by any archiver program. After making changes to the files inside omni.ja, you should re-optimize the file again for additional performance benefit by typing a slightly different command shown below.
optimizejars.py --optimize ./ ./ ./
Below is the proof of the optimization and deoptimization for the omni.ja file. The image below shows the original optimized omni.ja file opened with Notepad, a standard text editor built-in to Windows operating system. The beginning of the file header shows PK which is a standard signature for a ZIP file. You will find a lot of file paths which are the indexes of files in the archive at the beginning of omni.ja file as well.
Now let us take a look at the deoptimized omni.ja file in Notepad. We’ve scrolled right to the end of the file and as you can see, the indexes of files are being placed here instead and not at the beginning. If you look at the beginning of the file, you should also see that it starts with PK.
Do take note that whenever Firefox is updated, it is very likely that the omni.ja file will get updated as well overwriting your modified omni.ja file. This is one of the main reasons why extensions should be used instead of modifying the Firefox core files as it retains the modification while allowing you to easily keep your version of Firefox up to date.