This project will introduce complex aspects of the ThingWorx Java SDK and help you to get started with development.
Following the steps in this guide, you will develop your own IoT application with the ThingWorx Java SDK.
We will teach you how to use the Java programming language to connect and build IoT applications to be used with the ThingWorx Platform.
NOTE: This guide's content aligns with ThingWorx 9.3. The estimated time to complete all parts of this guide is 60 minutes.
Download the Java_SDK_Extra_Samples.zip attached to this article and extract the contents.
In this tutorial we walk you through a real-world scenario for a power grid network. The Java_SDK_Extra_Files.zip file provided to you contains the following files and Entities as a completed version of the scenario we will cover. Please keep in mind, the Java SDK can also be utilized for Android development and general Java development.
Name | Description |
PowerGrid | Source code for an extensive example of a power grid network |
Delivery Truck | Source code for the delivery truck application |
ExampleClient | Source code for examples on how to do different tasks |
FileTransfer | Source code for a file transfer application |
Tunneling | Source code for a tunneling application |
SimpleThing | Source code for simple connections and examples |
SteamSensor | Source code for a steam sensor that provides configuration during runtime |
Once you complete your Java environment setup and import the JavaExampleEntities.xml file into ThingWorx Composer, you will be able to utilize these Entities:
Feature | Entity Type | Description |
Generator1 | Thing | Used with the power grid edge example |
Generator2 | Thing | Used with the power grid edge example |
Generator3 | Thing | Used with the power grid edge example |
Consumer1 | Thing | Used with the power grid edge example |
Consumer2 | Thing | Used with the power grid edge example |
Consumer3 | Thing | Used with the power grid edge example |
DeliveryTruck_1 | Thing | Used with the delivery truck edge example |
DeliveryTruck_2 | Thing | Used with the delivery truck edge example |
DeliveryTruck_3 | Thing | Used with the delivery truck edge example |
FileTransferExample | Thing | Used with the file transfer edge example |
TunnelExample | Thing | Used with the tunnel edge example |
SimpleThing_1 | Thing | Used as a simple edge example for coding and connectivity |
SimpleDataShape | Data Shape | Used as a simple edge Data Shape example for coding and connectivity |
DeliveryTruckShape | Data Shape | Used as a Data Shape with the delivery truck edge example |
EdgeExample | Model Tag | Used as a Model Tag for tagging all entities; enables quicker searches |
DeliveryTable | Data Table | Used as a Data Table with the delivery truck edge example |
Default_user | User | User created to be used with the SDK examples |
PTC | Organization | An Organization that helps with security in edge examples |
Admin_key | Application Key | An Application Key used for the Admin |
Default_key | Application Key | An Application Key used for the Default User; this is the recommended key to use |
You can use the Java SDK with any IDE of your choice. The steps below demonstrate how to use the Eclipse IDE as an example.
If you have not already done so, install a Java Development Kit (JDK) from Corretto or OpenJDK in order to compile and run Java code and download the ThingWorx Java SDK. The download will include the JARs necessary to run the SDK.
The Eclipse Java IDE is a centralized location to store the code, resources, and files utilized by this guide. Download and install the latest Eclipse Java IDE from the Eclipse website.
Click Finish.
Click User Library. Click Next.
Click User Libraries.
Select the Javadoc in archive and External file radio buttons, then click Browse.
Click OK.
Click here to view Part 2 of this guide.