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:
- the Ice JAR files (
ice.jar
,icediscovery.jar
,icegrid.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. the
slice2java
compilerslice2java
is a command-line tool written in C++ and available on most platformsPlatform Ice Package with slice2java System Package? Debian 9 (stretch) zeroc-ice-compilers
yes Ubuntu libzeroc-ice-java
no RHEL, SLES, Amazon Linux libice-java
no macOS always installed with Ice no Windows always installed with Ice no the
db.jar
file and associated Berkeley DB C library, if you are using FreezePlatform Package with db.jar 5.3 System Package? Debian, Ubuntu libdb5.3-java
yes RHEL 7 libdb-java
yes RHEL 6, SLES, Amazon Linux db53-java
no macOS always installed with Ice no Windows always installed with Ice no 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
:
Name | Description |
---|---|
freeze | Persistent storage for Ice objects |
glacier2 | Generated proxy and skeleton classes plus helper classes for connecting to the Glacier2 service |
ice | The Ice core classes plus the IceSSL plug-in |
icebox | The IceBox server, and generated proxy and skeleton classes for connecting to IceBox |
icediscovery | The IceDiscovery plug-in |
icegrid | Generated proxy and skeleton classes for connecting to the IceGrid service |
icelocatordiscovery | The IceLocatorDiscovery plug-in |
icepatch2 | Generated proxy and skeleton classes for connecting to the IcePatch2 service |
icestorm | Generated 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.
groupId | version | artifactId |
---|---|---|
org.apache.tools | 1.0 | bzip2 |
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.
Platform | Default directory for db.jar |
---|---|
Linux | /usr/share/java |
macOS | /usr/local/share/java |
Windows | C:\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.
Platform | Directory of the Berkeley DB C library |
---|---|
RHEL, SLES, AMZN 32-bit | /usr/lib |
RHEL, SLES, AMZN 64-bit | /usr/lib64 |
Debian, Ubuntu i386 |
|
Debian, Ubuntu x86_64 |
|
macOS |
|
Windows 32-bit | C:\Program Files (x86)\ZeroC\Ice-3.6.5\bin |
Windows 64-bit | C:\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