zeroc ICE Quick Start 1 Environment Construction
1.1 1.1 Operating environment configuration 1.2 downloads
The version that this example downloads is Ice-3.5.1-6.msi
Https://zeroc.com/download/Ice/3.5/Ice-3.5.1-6.msi
1.3 Installing the ICE operating environment
Recommended to install in the root directory, if not installed in the root directory, it is also recommended not to be installed in a directory with spaces
This example installs the directory to C:\ZeroC\Ice-3.5.1, installs simultaneously will produce a Ice-3.5.1-demos directory, there are many demo, this example installs the position to be C:\ZeroC\Ice-3.5.1-demos
Configuring Environment variables
ice_home= C:\ZeroC\Ice-3.5.1
path=%ice_home%\bin;
classpath=%ice_home%\lib\ice.jar;%i Ce_home%\lib\db.jar;%i Ce_home%\lib\freeze.jar;%i Ce_home%\lib\icebox.jar;
Check if the installation was successful
Executing slice2cpp–v in the cmd window
installation is successful as shown above
1.4 Installing the Ice development plugin
This example uses an Eclipse version of 4.5,JDK version 1.8.0_60
Open Eclipse, select Help->eclipse Marketplace
The input Zeroc ice is shown below
Click Install, select Ice Builder for Eclipse 4.0.0 and install
After installation, eclipse will restart, click on windows->preferemces. Configure the ICE Runtime environment
Select an ice installation directory to
2 start Ice Tour 1.1 write the ice server side
Create a new Java Project
To add an ice property to a project
This will generate two directories, as follows
Create a new ice profile in the slice directory
a). Helloword. Ice
The code is as follows:
Module com
{
Modulemyice
{
Moduletest
{
Interfacehelloworld
{
Stringsayhello (string s);
};
};
};
};
b). Writing servant
Hellowordldi.java
Package com.myice.servant;
import Com.myice.test._helloworlddisp;
Import Ice.current;
Public class Hellowordldi extends _helloworlddisp{
@Override
Public Stringprintstring (String s,current __current) {
System. out. println ("Client message:" +s);
return "Hello World:" +s;
}
}
c). Publish servant using code, write server
Iceserver.java
Package com.myice.server;
import Com.myice.servant.HelloWordldI;
Public class Iceserver extends ice.application{
Public Static void Main (string[] a) {
Iceserver app = new iceserver ();
string[]args={"", ""};