• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..05-Feb-2019-

gradle/H05-Feb-2019-334281

msbuild/H05-Feb-2019-5141

src/H05-Feb-2019-106,70182,920

test/H05-Feb-2019-61,36250,238

.gitignoreH A D05-Feb-201947 76

MakefileH A D05-Feb-2019729 4529

README.mdH A D05-Feb-20199.7 KiB325241

allTests.pyH A D05-Feb-2019228 124

build.gradleH A D05-Feb-20193 KiB11393

gradle.propertiesH A D05-Feb-20192 KiB9377

gradlewH A D05-Feb-20195.2 KiB173128

gradlew.batH A D05-Feb-20192.2 KiB8561

settings.gradleH A D05-Feb-20191 KiB3430

README.md

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