Sat Dec 8, 2012
1. Setting up Google Protobuf - Compiling tools and API
Download Google Protobuf 2.4.1 from http://code.google.com/p/protobuf/downloads/list
Compile Google Protobuf
I’m using OSX Lion and Eclipse Juno. In OSX, before compiling you need to install command line tools. See here on how to do it. You can skip it, if you already have the command line tools installed. You can check if it is installed from Xcode 4 Preferences.
Continuing with the setting up, unzip the archive. Open terminal and change the directory to the unzipped directory and compile it using the following commands:
configure && sudo make install
The protobuf compiler is installed at
Create protobuf-2.4.1.jar API file
You’ll have to compile and bundle the Java API as well. The quickest way to do it is to use Maven to package the JAR file. Inside the protobuf-2.4.1 folder that you unzipped, open the terminal and change the directory to “java”. Use the following command to compile and bundle the JAR file:
This process creates a target directory where you’ll find protobuf-java-2.4.1.jar file. This JAR file is the Java API for reading/writing protobuf messages in Java. Therefore, it is very important.
2. Setting up Google Protobuf - Eclipse plugin
Now, we create an eclipse plugin from existing JAR archive just like the way we did it here.
Create a new Eclipse plugin project from existing JAR archives
Add external JAR file protobuf-2.4.1.jar that we just compiled
Enter name and version for the eclipse plugin
You should see the plugin in your package explorer now.
I’ve created a GitHub project for this plugin so that other users can use it without having to recompile the files.
That’s it for this part. In Part II , we’ll look in creating a RCP application and integrate the plugin we just created for serializing and deserializing data.