Building Ice Applications in Java

This page provides important information for Java developers.

On this page:

Prerequisites

In order to build applications with Ice in Java, you need:

  1. the Ice JAR files (ice.jar, icediscovery.jar, icegrid.jar, etc.)
    These JAR files are provided through Maven, as described below. Ice binary distributions for Debian and Ubuntu also include these JAR files.

  2. the slice2java compiler 
    slice2java is a command-line tool written in C++ and available on most platforms

    PlatformDistributionPackage with slice2java
    Debian and Ubuntuapt packageszeroc-ice-compilers
    RHEL, SLES, Amazon LinuxRPMsice-compilers
    macOShomebrewice
    WindowsMSIalways installed
    WindowsNuGetzeroc.ice.v100, zeroc.ice.v120, zeroc.ice.v140, zeroc.ice.v141

       

  3. the Ice Builder for Gradle, if you are using Gradle.

Java and Java Compat Mappings

Ice provides two distinct Slice-to-Java mappings:

  • Java
    This is a new mapping that takes advantage of features in Java 8. We recommend you select this mapping for new Ice-based applications written in Java.
  • Java Compat
    This mapping is largely backward-compatible with prior Ice releases and does not depend on any Java 8-specific language or run-time features.

slice2java, the Slice-to-Java code generator, generates code for the Java mapping by default.

Maven Repository

You can fetch all Ice build artifacts from the Maven Central repository. ZeroC provides the following JAR files, all in group com.zeroc with version 3.7.2:

NameDescription
glacier2Generated proxy and skeleton classes plus helper classes for connecting to the Glacier2 service
iceIce core
iceboxThe IceBox server, and generated proxy and skeleton classes for connecting to IceBox
icebtThe IceBT plug-in (only for Android)
icediscoveryThe IceDiscovery plug-in
icegridGenerated proxy and skeleton classes for connecting to the IceGrid service
icelocatordiscoveryThe IceLocatorDiscovery plug-in
icepatch2Generated proxy and skeleton classes for connecting to the IcePatch2 service
icesslThe IceSSL plug-in
icestormGenerated proxy and skeleton classes for connecting to the IceStorm service
NameDescription
glacier2-compatGenerated proxy and skeleton classes plus helper classes for connecting to the Glacier2 service
ice-compatIce core and IceSSL plug-in
icebox-compatThe IceBox server, and generated proxy and skeleton classes for connecting to IceBox
icebt-compatThe IceBT plug-in (only for Android)
icediscovery-compatThe IceDiscovery plug-in
icegrid-compatGenerated proxy and skeleton classes for connecting to the IceGrid service
icelocatordiscovery-compatThe IceLocatorDiscovery plug-in
icepatch2-compatGenerated proxy and skeleton classes for connecting to the IcePatch2 service
icestorm-compatGenerated proxy and skeleton classes for connecting to the IceStorm service


Bzip2

Ice for Java supports protocol compression using the BZip2 implementation included with Apache Commons Compress. Compression is automatically enabled if these classes are present in your CLASSPATH. The Maven package id for the JAR file is as follows:

groupIdversionartifactId
org.apache.commons1.14commons-compress

These classes are a pure Java implementation of the bzip2 algorithm and therefore add significant latency to Ice requests.

Using the Sample Programs

Sample programs are available at the ice-demos GitHub repository. You can browse this repository to see build and usage instructions for all supported programming languages. You can clone this repository with:

git clone -b 3.7 https://github.com/zeroc-ice/ice-demos.git
cd ice-demos