<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/2036/1/7/_/styles/combined.css?spaceKey=TOP&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/TOP/Building+Java+components">Building Java components</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~dlee">David M. Lee</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        install-ice -&gt; ice.install-ice<br />
    </div>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br># Set the environment variable {{ICE_HOME}} to your Ice installation prefix. <br></td></tr>
            <tr><td class="diff-changed-lines" ># Change to the {{slice}} directory, and run {{ant <span class="diff-changed-words">i<span class="diff-added-chars"style="background-color: #dfd;">ce.i</span>nstall-ice}}</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Building  <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Components that interact with Asterisk SCF may be written in <a href="http://java.com" class="external-link" rel="nofollow">Java</a>.  They can do this by using the Java bindings for the Asterisk SCF interfaces.</p>

<p>Asterisk SCF provides an <a href="htttp://ant.apache.org" class="external-link" rel="nofollow">Ant</a> <tt>build.xml</tt> file for building the Java bindings, and installing them into the local <a href="http://www.maven.org" class="external-link" rel="nofollow">Maven</a> repository.</p>

<h1><a name="BuildingJavacomponents-Buildinstructions"></a>Build instructions</h1>

<p>Before your begin, you must build Asterisk SCF itself.  See the appropriate <a href="/wiki/display/TOP/Installing" title="Installing">install page</a> for details.</p>

<p>If you've built Asterisk SCF from a clone of <tt>gitall</tt>, then you can cd into the <tt>slice</tt> directory.  Otherwise, you can obtain the latest Slice definitions by cloning <tt>git://git.asterisk.org/asterisk-scf/integration/slice</tt>.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Be sure that the Slice definitions you are using are consistent with those you used to compile Asterisk SCF.  The safest thing to do is to just build the Java bindings from the same sources you used to build Asterisk SCF.</td></tr></table></div>

<h2><a name="BuildingJavacomponents-%28Maven%29InstallingIcetothelocalrepository"></a>(Maven) Installing Ice to the local repository</h2>

<p>If you're using Maven, you must install the <tt>Ice.jar</tt> file to your local Maven repository.  Our <tt>build.xml</tt> file provides a <tt>install-ice</tt> target for doing just this.  You only need to do this once, or whenever you re-compile Ice.</p>

<ol>
        <li>Set the environment variable <tt>ICE_HOME</tt> to your Ice installation prefix.</li>
        <li>Change to the <tt>slice</tt> directory, and run <tt>ant ice.install-ice</tt></li>
</ol>


<h2><a name="BuildingJavacomponents-Building"></a>Building </h2>

<ol>
        <li>Set the environment variable <tt>ICE_HOME</tt> to your Ice installation prefix.</li>
        <li>Change to the <tt>slice</tt> directory, and run <tt>ant install</tt></li>
</ol>


<p>The build generates the following files:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: false; theme: Confluence; brush: java; gutter: false"><![CDATA[
  ./target/asterisk-scf-api.jar
  ./target/asterisk-scf-api-javadoc.jar
  ./target/asterisk-scf-api-sources.jar
]]></script>
</div></div>

<h1><a name="BuildingJavacomponents-UsagewithMaven"></a>Usage with Maven</h1>

<p>Add the following dependency to your <tt>pom.xml</tt> file:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: false; theme: Confluence; brush: xml; gutter: false"><![CDATA[
&lt;dependency&gt;
  &lt;groupId&gt;org.asterisk.scf&lt;/groupId&gt;
  &lt;artifactId&gt;api&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;
]]></script>
</div></div>

<h1><a name="BuildingJavacomponents-UsagewithoutMaven"></a>Usage without Maven</h1>

<p>Copy <tt>./target/asterisk-scf-api.jar</tt> to wherever you like to keep Java libraries, and add it to your classpath.  Also add <tt>$ICE_HOME/lib/Ice.jar</tt> to your classpath, where <tt>$ICE_HOME</tt> is the installation prefix for your Ice install.</p>

<p>If you use an IDE, I also recommend attaching the sources and javadoc to the library.  This makes navigating the API much easier.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://wiki.asterisk.org/wiki/display/TOP/Building+Java+components">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=9076752&revisedVersion=7&originalVersion=6">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/TOP/Building+Java+components?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>