Skip to content

Latest commit

 

History

History

java

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Java Integration

Overview

These examples show how to integrate Google Protocol Buffers with Ice for Java.

Ice supports metadata that makes it possible for you to specify Protocol Buffers message types in your Slice definitions, with Ice handling the serialization chores for you automatically. The metadata, which may only be used on a sequence type, has the following syntax in Java:

java:protobuf:protoc-generated-class

For example:

["java:protobuf:tutorial.PersonPB.Person"] sequence<byte> Person;

The type name specified in this example, tutorial.PersonPB.Person, corresponds to the Java class generated by the Protocol Buffers compiler (protoc) for the definition shown below:

package tutorial;
option java_outer_classname = "PersonPB";
message Person { ... };

Build Instructions

Prerequisites

If you've installed Ice in a non-standard location, you'll need to set the ICE_HOME environment variable with the path name of the installation directory. For example, on Linux or OS X:

$ export ICE_HOME=~/testing/Ice

On Windows:

$ set ICE_HOME=C:\Ice

Building

The build system for the Java sample programs uses Gradle and includes a wrapper script or batch file that automatically downloads Gradle and all other required components.

To build the demos, open a command window and run:

$ gradlew build

Running the Demo

To run the demo, first change to the demo directory and start the server:

$ java -jar build/libs/server.jar

In a separate window, start the client:

$ java -jar build/libs/client.jar

Running the Test

To run the test, change to the test directory and run the python script found there.

$ cd test
$ python run.py