For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 1 1 5

How to run example of IProvider and Consumer applications?

I'm trying to run below commands as per the guide:


java -cp .;target/RTSDKJ_Maven-1.0-jar-with-dependencies.jar com.refinitiv.ema.provider.IProvider

java -jar ./target/RTSDKJ_Maven-1.0-jar-with-dependencies.jar


But both commands throws class not found exception. When I checked inside the jar file, I couldn't find the specific classes as well.

Can anyone help me to find how to run these commands?

#technologyema-apiexample
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @hanhuitan ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text on the left side of the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


Upvote
Accepted
24.6k 54 17 14

Hello @hanhuitan

If your source code directory is based on the EMA Java source code like the following example.
ema-folder.png

Your pom.xml setting must be matched this directory structure as follows:

  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <mainClass>
                                        com.refinitiv.ema.examples.training.consumer.series100.ex100_MP_Streaming.Consumer
                                    </mainClass>
                                </manifest>
                            </archive>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Then you need to run the single-all-dependencies jar file with the following classpath

java -cp .;target/RTSDKJ_Maven-1.0-jar-with-dependencies.jar com.refinitiv.ema.examples.training.iprovider.series100.ex100_MP_Streaming.IProvider


java -jar ./target/RTSDKJ_Maven-1.0-jar-with-dependencies.jar

ema-folder.png (30.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @wasin.w ,


Could you please give me this project with maven?

Hello @hanhuitan

The project above is based on the How to Set Up Refinitiv Real-Time SDK Java Application with Maven article, but you need to change the source code to the EMA Java example one.

Another practical step-by-step guide to set up an EMA Java examples project with Maven is the How to Set Up Real-Time SDK Java Application with Maven on the Eclipse IDE article.

As I said earlier, the RTSDK Java is available with Gradle-based by default. However, you can submit a change request to the product team via the https://my.refinitiv.com/content/mytr/en/feedback.html page.

Upvote
24.6k 54 17 14

Hello @hanhuitan

It seems the RTSDKJ_Maven-1.0-jar-with-dependencies.jar file does in included the Dependencies classes.

How did you build the jar? I am assuming that you are using Maven, did you set Maven to build a single-all-dependencies jar file in the pom.xml file?

You can find an example in the "Building the project" section of the How to Set Up Refinitiv Real-Time SDK Java Application with Maven article.

Please note that the classpath in a <manifest> tag must match the source code directory.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    ...
    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass><Main Class></mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    </build>
</project>
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
24.6k 54 17 14

Hello @hanhuitan

Which version of the EMA API you are using?

  • If you want to use EMA Java 3.6.7.0 L1 --> Please specify the EMA library version "3.6.7.1" in the pom.xml dependency setting
  • If you want to use EMA Java 3.6.7.0 L2 --> Please specify the EMA library version "3.6.7.3" in the pom.xml dependency setting
<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>com.refinitiv.ema</groupId>
      <artifactId>ema</artifactId>
      <version>${rtsdk.version}</version>
    </dependency>

Hope this helps.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 1 1 5

Hi,


Can I get a maven example project instead of Gradle?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @hanhuitan

The RTSDK Java is currently available with Gradle-based by default. However, you can submit a change request to the product team via the https://my.refinitiv.com/content/mytr/en/feedback.html page.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.