How do I create a RTI Connext Java application in Eclipse?
Note: Applies to RTI Connext 4.x and above.
- Start Eclipse in the Java perspective.
- Right-click in the white area of Package Explorer and select New, Java Project
- In the New Java Project dialog, for the Project name, enter: MyDDSProject
- Click Finish. (This creates MyDDSProject in the Package Explorer directory. Under that is a src directory and JRE System Library resources.)
- Right-click on MyDDSProject and select Properties, Java Build Path. From the Libraries tab, select Add External Jars.... The Jar Selection file browser will pop up.
- Browse to the <RTI Connext installation directory>/class directory, select the nddsjava.jar file, click Open.
- Click OK. (Under MyDDSProject, you will see Referenced Libraries; under that is the nddsjava.jar that you entered above.)
- Open a command shell and change to the directory of the Eclipse workspace that you created (.../workspace/MyDDSProject/src) and create a DDS Java application:
- Create your IDL file. In this example, we will assume the IDL filename is HelloWorld.idl.
- Run rtiddsgen as follows:
rtiddsgen -language Java -example <architecture> HelloWorld.idl
- Verify HelloWorld*.java files are created.
- Back in Eclipse, right-click on MyDDSProject, Refresh. The MyDDSProject/src has a (default package) subfolder. Select (default package). The Java source files that you created with rtiddsgen are now visible in Eclipse. Make any updates to the HelloWorldPublisher/Subscriber.java files that you desire.
- Run the HelloWorldPublisher/Subscriber.java files:The PATH environment variable needs to be set before running the HelloWorld application.
- Double-click (default package) to expand the folder
- Select the file you want to run (such as HelloWorldSubscriber.java)
- From the menu bar, select Run, Run Configurations…
- Select the Environment tab
- Select New and set the "PATH" variable to the location of ndds java libraries.If you want to use an XML QoS configuration file, then the working directory needs to be set as indicated below
- Select the (x)= Arguments tab
- Under working directory, select Other: and then click on File System…
- Browse to <your workspace>/<your project name>/srcIf you are using a release prior to 4.4d or you do not want to use an XML file, then the above 3 steps can be skippedClick Apply and Run. You will see the application's output in the Console tab.
Comments
rip
Mon, 09/16/2013 - 06:10
Permalink
How to run rtiddsgen from within Eclipse
How to run rtiddsgen from within Eclipse:
Windows:
MacOS:
Once the tool is configured, you can clone it and change the name/arguments list to get different behavior:
To run the script, click on an IDL file in a project, and select the desired external tool configuration. The code will be generated into that project's src directory, including any packages (from IDL module declarations).