In order to compile and run sample clients for WSO2 Gadget Server, it is necessary to install Apache Ant on Windows.
See GS Installation Prerequisites for the list of all applications necessary to install and work with WSO2 GS, and links to them.
Follow the instructions below to install Apache Ant.
Step 1. Check Java
Make sure you have a JDK installed on your system. See Apache Ant System Requirements for details.
Step 2. Download Apache Ant
1. Open a Web browser and access the following URL:
2. Apache Ant project home page opens.
3. There is the link to the latest stable Apache Ant version download on the opened page. Follow it.
4. Current version of download page opens with links to the archive installation packs. Choose the necessary archive type and follow the proper link.
The binary edition of Ant is shipped with 3 different compression formats: * .zip - Recommended compression format for Windows, can also be used on other platforms. Supported by many programs and some operating systems natively.
- .tar.gz - Uses the tar program to gather files together, and GZIP to compress and uncompress.
- .tar.bz2 - Uses the tar program to gather files together, and BZIP2 to compress and uncompress.
Choose the format that is best supported for your platform.
5. Dialog box opens with a request for download confirmation. Click "OK."
6. The download starts.
Step 3. Extract the Archive
After the download is complete, extract installation files to the user-defined folder. For example, c:\wso2\apache-ant-1.8.2.
Step 4. Set up Environment Variables for Apache Ant
Before you can run Ant, there is some additional set up you will need to do:
- Set the ANT_HOME environment variable to the Ant installation directory.
- Add the bin directory to the PATH variable.
- Set the JAVA_HOME environment variable. Proceed to Set up JAVA_HOME section for the detailed information on the JAVA_HOME environment variable set up.
Environment variables are global system variables accessible by all the processes running under the operating system.
Follow the instructions below to set up ANT_HOME.
1. Right-click the "My Computer" icon on the desktop.
2. Click "Properties" in the displayed pop-up.
3. The "System Properties" window opens with its functional tabs. Go to the "Advanced" tab and click "Environment Variables."
4. The "Environment variables" window opens. Click the "New" button under "System variables."
5. The "New system variable" input box opens. Type "variable name": ANT_HOME, and "variable value": <Ant installation directory>. For example, c:\wso2\apache-ant-1.8.2. Click "OK."
6. ANT_HOME variable is added to system variables.
Adding bin to PATH
Follow the instructions below to add the "bin" directory to the PATH variable.
1. In the "System variables" list select PATH variable, and click "Edit."
2. The "Edit system variable" input box opens.
Add <ANT_HOME\bin> without quotes to "Variable value", where <ANT_HOME> is the Ant installation folder. For example, c:\wso2\apache-ant-1.8.2\bin.
3. The "bin" directory is added to the PATH variable.
"System variables" or "User variables"?
In case there is a need to set up variables only for the user currently logged in, JAVA_HOME should be set up in "User Variables" (the same way as in "System variables"). These changes will not affect any other users.
Variable set up will be effective for the CMD opened after this operation. In case a CMD was run before the variable was set up, this change will not be effective for it. To ensure the variable set up is effective, and variable value is reset, close and reopen the CMD you will run GS from, or close and reopen the browser you run the CMD from.
The ant.bat script makes use of three environment variables ANT_HOME, CLASSPATH and JAVA_HOME. Ensure that ANT_HOME and JAVA_HOME variables are set, and that they do not have quotes (either ' or ") and they do not end with \ or with /. CLASSPATH should be unset or empty.
Apache Ant is installed.