Technical Helpweb

Dialogic® PowerMedia™ Extended Media Server (PowerMedia XMS) - more articles

How to Run the Sample XMS Java Client Library in Eclipse

Introduction:

This article describes how to run the sample XMS Java Client Library for Dialogic® PowerMedia™ XMS (PowerMedia XMS) and example demos in the Eclipse integrated development environment (IDE).  

Background:

The XMS Java Client Library is a sample java client side library to be used with the PowerMedia XMS in order to demonstrate writing a java based RESTful/MSML application. It was originally developed using the NetBeans IDE.  A user may want to utilize the Eclipse IDE to make changes or to run any of the demos; this article describes the steps needed to use the XMS Java Client Library within the Eclipse IDE.

Details:

The XMS Java Client Library can be obtained from the Github repository located here.   This version includes the REST and MSML modes. When the user wants to run a demo, they can choose either REST or MSML mode to execute the demo.  For detailed steps on obtaining the XMS Java Client Library, please refer step 2 to in the Getting started with XMS Client Library article.

Requirements:

The XMS Java Client Library requires Java 1.8 and (as of November 2015) can be downloaded from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

The Eclipse version information is listed below. 

  • Eclipse Mars version:

  • name=Eclipse Platform

  • id=org.eclipse.platform

  • version=4.5.0

Eclipse IDE (as of November 2015) can be downloaded here - http://www.eclipse.org/downloads/packages/release/Mars/1

Procedure:

1) Eclipse Setup:

  • Download Eclipse IDE from the above link and the follow the install wizard and complete the installation.

  • Once Eclipse is up and running, make sure it uses Java 1.8. Go to Windows->Preferences

    • Ensure the compiler option is set to 1.8.  Go to Windows->Preferences->Java->Compiler

Compiler.PNG

    • Add JDK 1.8 to your build path. Windows->Preferences->Java->Installed JREs. Make sure this is pointing to the JDK and not JRE

InstalledJRE.PNG

    • Double click on the JDK under Installed JRE (see above). Make sure the tools.jar exists in the classpath. 

Toolsjar.PNG

    • Make sure the JavaSE1.8 is pointing to JDK 1.8.  Windows->Preferences->Java->Installed JREs->Execution Environments

ExecutionEnviron.PNG

  

2) Getting /Running XMS Java Client Library in Eclipse

  • In Eclipse, go to File -> New -> Java Project. Uncheck the "Use default location" box and browse to the location where you downloaded and unzipped the project from Github. Click on finish.

 NewProject.PNG

ExistingSource.PNG

  • The project will appear on the left hand side. Right click on the project folder, go to Properties -> Java Build Path -> Libraries.  In Libraries you can clean up the jars by removing all the jars generated by "Examples" folder. This is to make sure that only the jars from the main project are in the build path.

ClearLibraries.PNG

BuildSuccess.PNG

In some of the cases the build may fail because of a javadoc error

  • If you get the following error around javadoc.exe

Error:

"build.xml:208: Javadoc failed: java.io.IOException: Cannot run program "javadoc.exe": CreateProcess error=2, The system cannot find the file specified"

Solution: This happens if Ant cannot find javadoc on the system path. You can modify the system path to include this or if you do not want to use the system path then you can simply modify the path in Eclipse. You can refer to this link to set the eclipse path - http://blog.darevay.com/2008/12/running-javadoc-ant-task-from-eclipse/

  • If you get an error around javadoc formatting

Error:

"[javadoc] Building index for all the packages and classes...  [javadoc] Building index for all classes...  [javadoc] Generating C:\Users\ssatyana\Documents\CL-downloaded\dialogic-XMSClientLibrary-master\dialogic-XMSClientLibrary-master\XMSClientLibrary\dist\javadoc\help-doc.html...  [javadoc] 100 errors  [javadoc] 100 warnings
BUILD FAILEDC:\Users\ssatyana\Documents\CL-downloaded\dialogic-XMSClientLibrary-master\dialogic-XMSClientLibrary-master\XMSClientLibrary\nbproject\build-impl.xml:1209: Javadoc returned 1
Total time: 19 seconds"

Solution: This is related to running Javadoc on JDK 1.8. The solution is to disable doclint in javadoc build. Add an arg value to the javadoc task in build-impl.xml which is under nbproject folder. 

<javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" ..........>           

...........          

<arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>       

<arg value="-Xdoclint:none"/>       

</javadoc>

Add "<arg value="-Xdoclint:none"/>" after line 1220 in build-impl.xml.

3. Generate Jaxb classes using msml.xsd file

After building the project, you may notice import errors in some of the classes. This is because they refer to the jaxb classes which are generated by the .xsd file. To generate the jaxb classes, go to xml-resources->jaxb->XMSMsml folder.   You will find the msml.xsd file. Right click on msml.xsd, go to Generate->Jaxb classes, this opens the JAXB classes window:

 Jaxbwindow.PNG

Enter the package name "com.dialogic.xms.msml" and click finish. This will generate the classes for you.

Jaxbpackage.PNG 

4)  Running one of  the Client Library demos

  • Get the project to Ecplise in the same way as explained above. New -> Java Project ->Select the location of the demo source -> Finish.

 EchoTest.PNG

  • Now, Right click on the project under Project Explorer, go to Properties -> Java build Path -> Libraries -> Add jar, Add the jar under XMSClientLibrary/dist/XMSClientLibrary.jar and all the jars under the jars folder(XMSClientLibrary/jars/) -> Apply -> OK.

 EchoTestJars.PNG

  • Run the demo, you will get the following window:

EchoTestRun.PNG

Product List:

Dialogic® PowerMedia™ XMS Release 2.4

Related Links:

XMS Java Client Library Github repository


Legal Note

This document discusses one or more open source products, systems and/or releases. Dialogic is not responsible for your decision to use open source in connection with Dialogic products (including without limitation those referred to herein), nor is Dialogic responsible for any present or future effects such usage might have, including without limitation effects on your products, your business, or your intellectual property rights.


See also:
Getting Started with XMS REST Application Development using Sample XMS Java Client Library
XMSEchoTest - XMS Java Client Library Sample - for REST Application Development


Feedback

Please rate the usefulness of this page:  
0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page:

First published: 19-May-2016
Open access: Product rule: open; Page rule: Auto