The following describes how to create a new Java application with automatically inserted class templates (also see Application).
Create a new empty project
![]() |
Click on the File menu and select New in the JoC Manager to open the configuration wizard. |
![]() |
There are several ways to select a board in the next step. When an JoC board is connected to the computer the Auto-Set button can be pressed to select the board currently in use. In case there is no board available select an JoC board. |
![]() |
Create New button can be clicked after the desired panel is selected. | The
Add Java class files to the empty project
![]() |
New on the "Java" ribbon. Follow the dialogs to create two basic template classes, a Main Class and an Application Class. The files can be located anywhere, it's however recommended to keep all files in the same root folder. | To add a basic Java application to the JoC project select
![]() |
Both java classes will be added to the newly created Java App. Notice that the Main Class has a special icon. It contains
the main entry point of the Java application:
public static void main(String[] args) There can only be one Main Class in an Java application. The Java application can already be build but want do anything interesting yet. |
Add the following code to write simple text messages to the console every second.
Add code to the App class:
Put the following code in the application class, e.g. App.
private int countOnUpdateMethodCall;
Put the following code into the constructor App().
try
{
countOnUpdateMethodCall = 0;
Console.println(" " + countOnUpdateMethodCall +
". onUpdate() call \r");
}
catch(Exception exc)
{
Logger.e(exc.getMessage());
}
Put the following code into the onUpdate() method.
// count each call to the onUpdate() method
countOnUpdateMethodCall++;
try
{
// draw the count of the onUpdate() calls to the screen
Console.println(" " + countOnUpdateMethodCall +
". onUpdate() call \r");
}
catch(Exception exc)
{
Logger.e(exc.getMessage());
}
// wait a second
try
{
Thread.sleep(1000);
}
catch(InterruptedException ie)
{
Logger.e(ie.getMessage());
}
After coding is done
![]() |
Run button. This will start the debugger. Notice that everything will be automatically downloaded to the JoC board. Feel free to add breakpoints to the OnUpdate() method. Now, every second a message is written to the screen. | Click the
Copyright © demmel products gmbh. All rights reserved.