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.jaricediscovery.jaricegrid.jar, etc.)
    These JAR files are provided through Maven, as described below. The Ice binary distributions for most platforms include these JAR files as well.

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

    PlatformIce Package with slice2javaSystem Package?
    Debian 9 (stretch)zeroc-ice-compilersyes
    Ubuntulibzeroc-ice-javano
    RHEL, SLES, Amazon Linuxlibice-javano
    macOSalways installed with Iceno
    Windowsalways installed with Iceno

       

  3. the db.jar file and associated Berkeley DB C library, if you are using Freeze

    PlatformPackage with db.jar 5.3System Package?
    Debian, Ubuntulibdb5.3-javayes
    RHEL 7libdb-javayes
    RHEL 6, SLES, Amazon Linuxdb53-javano
    macOSalways installed with Iceno
    Windowsalways installed with Iceno
  4. the Ice Builder for Gradle, if you are using Gradle.

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.6.5:

NameDescription
freezePersistent storage for Ice objects
glacier2Generated proxy and skeleton classes plus helper classes for connecting to the Glacier2 service
iceThe Ice core classes plus the IceSSL plug-in
iceboxThe IceBox server, and generated proxy and skeleton classes for connecting to IceBox
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
icestormGenerated proxy and skeleton classes for connecting to the IceStorm service

Bzip2

Ice for Java supports protocol compression using the bzip2 implementation included with ant. Compression is automatically enabled if these classes are present in your CLASSPATH. You can either add ant.jar to your CLASSPATH, or download only the bzip2 classes from http://www.kohsuke.org/bzip2.

You can also retrieve this bzip2 JAR file from ZeroC's Maven repository located at https://repo.zeroc.com/nexus/content/repositories/thirdparty.

groupIdversionartifactId
org.apache.tools1.0bzip2

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

Freeze and Berkeley DB

In order to build with Freeze for Java, you need to add both freeze-3.6.5.jar and the Berkeley DB JAR file (db.jar) to your build path.

PlatformDefault directory for db.jar
Linux/usr/share/java
macOS/usr/local/share/java
WindowsC:\Program Files (x86)\ZeroC\Ice-3.6.5\lib


Then, when you run a Freeze-based application, the JVM requires that the directory containing Berkeley DB's C library be listed in its java.library.path. You can set java.library.path explicitely (with java -Djava.library.path=...) or through an environment variable: LD_LIBRARY_PATH on Linux and PATH on Windows.

PlatformDirectory of the Berkeley DB C library
RHEL, SLES, AMZN 32-bit/usr/lib
RHEL, SLES, AMZN 64-bit/usr/lib64
Debian, Ubuntu i386
/usr/lib/i386-linux-gnu
Debian, Ubuntu x86_64
/usr/lib/x86_64-linux-gnu
macOS
/usr/local/opt/berkeley-db53/lib
Windows 32-bitC:\Program Files (x86)\ZeroC\Ice-3.6.5\bin
Windows 64-bitC:\Program Files (x86)\ZeroC\Ice-3.6.5\bin\x64

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.6 https://github.com/zeroc-ice/ice-demos.git
cd ice-demos