How to create chrome crx file programmatically (preferably in java)?

As kylehuff stated, there are external tools that you could use. But you can always use the command line from Google Chrome to do that which is cross platform (Linux / Windows / Mac).

chrome.exe --pack-extension=[extension_path] --pack-extension-key=[extension_key]

--pack-extension is:

Package an extension to a .crx installable file from a given directory.

--pack-extension-key is:

Optional PEM private key is to use in signing packaged .crx.

The above does not run Google Chrome, it is just command line packing using Chromium's core crx algorithm that they use internally.


There is a variety of utilities to do this, in various languages (albeit; they are mostly shell/scripting languages)

I cannot post the links to all of them, because I am a new stackoverflow user - I can only post 1 link, so I created a page which lists them all - including the one C one I speak about below - http://curetheitch.com/projects/buildcrx/6/

Anyway, I spent a few hours and put together a version in C which runs on Windows or Linux, as the other solutions require installation of a scripting language or shell (i.e. python, ruby, bash, etc.) and OpenSSL. The utility I wrote has OpenSSL statically linked so there are no interpreter or library requirements.

The repository is hosted on github, but the link above has a list of my utility and other peoples solutions.

Nothing listed for Java, which was your preference, but hopefully that helps!