1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
# Ice for Java build instructions
This page describes how to build and install Ice for Java from source. If
you prefer, you can also download a [binary distribution].
* [Build Requirements](#build-requirements)
* [Operating Systems](#operating-systems)
* [Slice to Java Compiler](#slice-to-java-compiler)
* [JDK Version](#jdk-version)
* [Gradle](#gradle)
* [Bzip2 Compression](#bzip2-compression)
* [JGoodies](#jgoodies)
* [ProGuard](#proguard)
* [Java Application Bundler](#java-application-bundler)
* [Building Ice for Java](#building-ice-for-java)
* [Installing Ice for Java](#installing-ice-for-java)
* [Running the Java Tests](#running-the-java-tests)
* [Building the Ice for Android Tests](#building-the-ice-for-android-tests)
* [IceGrid GUI Tool](#icegrid-gui-tool)
## Build Requirements
### Operating Systems
Ice for Java builds and runs properly on Windows, macOS, and any recent Linux
distribution. It is fully supported on the platforms listed on the [supported platforms]
page.
### Slice to Java Compiler
You need the Slice to Java compiler to build Ice for Java and also to use
Ice for Java. The Slice to Java compiler (`slice2java`) is a command-line tool
written in C++. You can build the Slice to Java compiler from source, or
alternatively you can install an Ice [binary distribution] that includes
this compiler.
### JDK Version
You need JDK 8, JDK 11, JDK 17, or JDK 21 to build Ice for Java.
Make sure that the `javac` and `java` commands are present in your PATH.
> The build produces bytecode in the Java 8 class file format ([major version] 52).
The IceGrid GUI tool's Metrics Graph feature requires JavaFX support. If you
build the source with a JVM that lacks JavaFX support, this feature will be
unavailable. Alternatively, building the source in an environment with
JavaFX produces an IceGrid GUI JAR file that can be used in JVMs with or without
JavaFX support, as the Metrics Graph feature is enabled dynamically.
### Gradle
Ice for Java uses the [Gradle] build system, and includes the Gradle wrapper
in the distribution. You cannot build the Ice for Java source distribution without
an Internet connection. Gradle will download all required packages automatically
from the Maven Central repository located at https://repo1.maven.org/maven2/
### Bzip2 Compression
Ice for Java supports protocol compression using the bzip2 classes included
with [Apache Commons Compress].
The Maven package ID for the commons-compress JAR file is as follows:
```gradle
groupId=org.apache.commons, version=1.20, artifactId=commons-compress
```
The demos and tests are automatically setup to enable protocol compression by
adding the commons-compress JAR to the manifest class path. For your own
applications you must add the commons-compress JAR to the application `CLASSPATH`
to enable protocol compression.
### JGoodies
The IceGrid GUI tool uses the JGoodies libraries Forms and Looks. The following
versions were tested:
* JGoodies Forms 1.9.0
* JGoodies Looks 2.7.0
The Maven package ids for the JGoodies packages are as follows:
```gradle
groupId=com.jgoodies, version=1.9.0, artifactId=jgoodies-forms
groupId=com.jgoodies, version=2.7.0, artifactId=jgoodies-looks
```
### ProGuard
Gradle uses [ProGuard] to create the standalone JAR file for the IceGrid
GUI tool.
The Maven package id for the ProGuard gradle plugin is as follows:
```gradle
groupId=com.guardsquare, version=7.3.1, artifactId=proguard-gradle
```
### Java Application Bundler
Under macOS Gradle uses the Java Application Bundler to create an application
bundle for the IceGrid GUI tool.
The Maven package id for the application bundler package is as follows:
```gradle
groupId=com.panayotis, version=1.1.0, artifactId=appbundler
```
## Building Ice for Java
The build system requires the Slice to Java compiler from Ice for C++. If you
have not built Ice for C++ in this source distribution, you must set the
`ICE_BIN_DIST` environment variable to `cpp` and the `ICE_HOME` environment
variable with the path name of your Ice installation. For example, on Linux with
an RPM installation:
```shell
export ICE_BIN_DIST=cpp
export ICE_HOME=/usr
```
On Windows with an MSI installation:
```shell
set ICE_BIN_DIST=cpp
set ICE_HOME=C:\Program Files\ZeroC\Ice-3.7.10
```
If you are using Ice for C++ from a source build on Windows, you must set
the `CPP_PLATFORM` and `CPP_CONFIGURATION` environment variables to match the
platform and configuration used in your C++ build:
```shell
set CPP_PLATFORM=x64
set CPP_CONFIGURATION=Debug
```
The supported values for `CPP_PLATFORM` are `Win32` and `x64` and the supported
values for `CPP_CONFIGURATION` are `Debug` and `Release`.
Before building Ice for Java, review the settings in the file
`gradle.properties` and edit as necessary.
To build Ice, all services, and tests, run
```shell
gradlew build
```
Upon completion, the Ice JAR and POM files are placed in the `lib` subdirectory.
If at any time you wish to discard the current build and start a new one, use
these commands:
```shell
gradlew clean
gradlew build
```
## Installing Ice for Java
To install Ice for Java in the directory specified by the `prefix` variable in
`gradle.properties` run the following command:
```shell
gradlew install
```
The following JAR files will be installed to `<prefix>/lib`.
* glacier2-3.7.10.jar
* ice-3.7.10.jar
* icebox-3.7.10.jar
* icebt-3.7.10.jar
* icediscovery-3.7.10.jar
* icegrid-3.7.10.jar
* icegridgui.jar
* icelocatordiscovery-3.7.10.jar
* icepatch2-3.7.10.jar
* icessl-3.7.10.jar
* icestorm-3.7.10.jar
POM files are also installed for ease of deployment to a Maven-based
distribution system.
## Running the Java Tests
Some of the Ice for Java tests employ applications that are part of the Ice for
C++ distribution. If you have not built Ice for C++ in this source distribution
then you must set the `ICE_HOME` environment variable with the path name of your
Ice installation. On Unix:
```shell
export ICE_HOME=/opt/Ice-3.7.10 (For local build)
export ICE_HOME=/usr (For RPM installation)
```
On Windows:
```shell
set ICE_HOME=C:\Program Files\ZeroC\Ice-3.7.10
```
Python is required to run the test suite. To run the tests, open a command
window and change to the top-level directory. At the command prompt, execute:
```shell
python allTests.py
```
If everything worked out, you should see lots of `ok` messages. In case of a
failure, the tests abort with `failed`.
## Building the Ice for Android Tests
The `test/android/controller` directory contains an Android Studio project for
the Ice test suite controller.
### Android Build Requirements
To build an Ice application for Android, you need Android Studio and the Android SDK
build tools. We tested the following components:
* Android Studio Giraffe
* Android SDK 33
To use Ice's Java mapping with Java 8, you need at least API level 24:
* Android 7 (API24)
### Building the Android Test Controller
You must first build Ice for Java refer to [Building Ice for Java](#building-ice-for-java)
for instructions, then follow these steps:
1. Start Android Studio
2. Select "Open an existing Android Studio project"
3. Navigate to and select the "java/test/android/controller" subdirectory
4. Click OK and wait for the project to open and build
To build the tests against the Ice binary distribution you must set `ICE_BIN_DIST` environment
variable to `all` before starting Android Studio.
### Running the Android Test Suite
The Android Studio project contains a `controller` app for the Ice test
suite. Prior to running the app, you must disable Android Studio's Instant Run
feature, located in File / Settings / Build, Execution, Deployment /
Instant Run.
Tests are started from the dev machine using the `allTests.py` script, similar
to the other language mappings. The script uses Ice for Python to communicate
with the Android app, therefore you must build the [Python mapping] before continuing.
You also need to add the `tools\bin`, `platform-tools` and `emulator`
directories from the Android SDK to your PATH. On macOS, you can use the
following commands:
```shell
export PATH=~/Library/Android/sdk/cmdline-tools/latest/bin:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
export PATH=~/Library/Android/sdk/emulator:$PATH
```
On Windows, you can use the following commands:
```shell
set PATH=%LOCALAPPDATA%\Android\sdk\cmdline-tools\latest\bin;%PATH%
set PATH=%LOCALAPPDATA%\Android\sdk\platform-tools;%PATH%
set PATH=%LOCALAPPDATA%\Android\sdk\emulator;%PATH%
```
Run the tests with the Android emulator by running the following command:
```shell
python allTests.py --android --controller-app
```
To run the tests on a Android device connected through USB, you can use
the `--device=usb` option as shown below:
```shell
python allTests.py --android --device=usb --controller-app
```
To connect to an Android device that is running adb you can use the
`--device=<ip-address>`
```shell
python allTests.py --android --device=<ip-address> --controller-app
```
To run the tests against a `controller` application started from Android
Studio you should omit the `--controller-app` option from the commands above.
## IceGrid GUI Tool
Ice for Java includes the IceGrid GUI tool. It can be found in the file
`lib/icegridgui.jar`.
This JAR file is completely self-contained and has no external dependencies.
You can start the tool with the following command:
```shell
java -jar icegridgui.jar
```
On macOS, the build also creates an application bundle named IceGrid GUI. You
can start the IceGrid GUI tool by double-clicking the IceGrid GUI icon in
Finder.
[binary distribution]: https://zeroc.com/downloads/ice
[major version]: https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.1-200-B.2
[supported platforms]: https://doc.zeroc.com/ice/3.7/release-notes/supported-platforms-for-ice-3-7-10
[Gradle]: https://gradle.org
[ProGuard]: http://proguard.sourceforge.net
[Apache Commons Compress]: https://commons.apache.org/proper/commons-compress/
[Python Mapping]: ../python
|