RTSJ Hello World

Working with the TimeSys reference implementation of the RTSJ installed on a Linux system in /usr/local/timesys and with the Sun JDK tools, we show here a step-by-step procedure for creating and running a hello world program for real time.

Hello world doesn't have significant timeliness constraints, so Example 8-1 will just run the standard hello world in a real-time thread.

Example 8-1. RT hello world program
import javax.realtime.*;

public class Hello1 {
  public static void main(String [] args){
    RealtimeThread rt= new RealtimeThread(){
      public void run() {
        System.out.println("Hello RT world");
      }
    };
    if(!rt.getScheduler().isFeasible())
      System.out.println("Printing hello is not feasible");
    else
      rt.start();
  }
}

The program shown ...

Get Real-Time Java™ Platform Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.