Wednesday, September 17, 2008

Reading Chrome's bookmarks in java

Google recently released Chrome, a browser based on WebKit (the same one used by Safari). The user interface is quite pleasant and so is its functionality. A few improvements need to be made (for eg.: addition of plugins, RSS feed reader, autofill in textboxes) before it endears itself to techies and common users. Its V8 engine definitely appears to make JavaScript run a whole lot faster than other browsers (even better than Opera in my tests). This video explains a little more on its architecture and working:
V8: an open source JavaScript engine

Having worked on synchronizing various user settings and files from within the major browsers (namely IE, FF, Safari, Opera and Konqueror), it was only natural I started breaking down Chrome and its settings. The first thing I've looked into is finding a way to synchronize its bookmarks. As of this writing, Chrome currently is built for only Windows XP and Windows Vista, with versions for Mac and Linux expected sometime in the near future. Chrome uses SqlLite databases to save all of the settings and preferences. The following blog entry provided some great insights into how the bookmarks are stored in these files:
Greg Duncan's blog

Enriched with the information from the link above, I found writing a java program to extract the bookmarks really simple. With the inclusion of the SQLLite Java wrapper and the corresponding JDBC driver binary, reading from the tables turned out to be a snap. The program was compiled in Netbeans 6.1 with Java 1.6 on a Windows Vista Home Basic edition.

You can download the entire netbeans project from the following link:
ChromeBookmarks.rar

Please feel free to use this code in any way you would like. Just don't point my way if anything crashes ;-)

Cheers.

3 comments:

branajam said...

Hi,
My name is James Branam and I'm the NetBeans Community Docs Manager. Your blog entry would make a fantastic tips and tricks entry for our Community Docs wiki (http://wiki.netbeans.org//CommunityDocs). Would you be willing to contribute it? If you need any help or have any questions, please contact me at james.branam@sun.com. I look forward to hearing from you.

Anonymous said...

Hey Avinash,

My name is Varun Nischal and I'm the NetBeans Community Docs Coordinator. I would like to notify you that your blog has been contributed here, have a look.

Also, its now listed over here.

Welcome to NetBeans Community!

Avinash said...

Hi Varun.

Thanks for inculding my post on the Netbeans community forums. I didn't have time in the last couple of months to post it myself, but it does look great.

Cheers.