### HelloWorld (Non-UI)

B4J Non-UI Example HelloWorld
This app outputs HelloWorld to the terminal on the Raspberry Pi (RPi).
Develop the B4J Code helloworld.b4j
'Non-UI application (console / server application)
Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
End Region
`Sub Process_Globals
Private CAPPVERSIOn As String = "B4J HowTo Raspberry Pi - Non-UI HelloWorld 20140928"
End Sub`
`Sub AppStart (Args() As String)
Log(CAPPVERSIOn)
Log(DateTime.Time(DateTime.Now) & " :: Start")
Log("Hello World")
Log(DateTime.Time(DateTime.Now) & " :: End")
End Sub`
Start the B4J-Bridge on the RPi
Option 1: Start from RPi; B4J-Bridge stored in /home/pi/b4j
• Login to RPi as user Pi
• $cd b4j
• $sudo java -jar b4j-bridge.jar
Option 2: Start from development device using Putty
• Run putty.exe
• Connect to RPi as user Pi
• $cd b4j
• $sudo java -jar b4j-bridge.jar
Output of the B4J-Bridge after started on the RPi:
B4J-Bridge v1.00
Waiting for connections (port=6790)...
My IP address is: 192.168.0.23
Test the B4J Code from the B4J IDE
Connect from the B4J IDE to the B4J-Bridge running on the RPi
Select Tools > B4J-Bridge > Connect > Select IP or add new
If connection successful:
The B4J IDE shows botton left B4J-Bridge status: Connected
The B4J-Bridge output on the RPi shows Connected!
Run the program
Press F5 to compile in the B4J IDE
If successfull:
B4J IDE Logs shows the output:
B4J HowTo Raspberry Pi - Non-UI HelloWorld 20140928
10:45:31 :: Start
Hello World
10:45:32 :: End
B4J-Bridge output on the RPi shows:
Starting program
ProcessCompleted
Install jar on the RPi
Example:
• Create a folder on the RPi, like /home/pi/b4j/helloworld
• Copy, using WinSCP, helloworld.jar from the Development Device to the folder created
• Run the application from the commandline: java -jar helloworld.jar

Changed: 2018-04-14 19:04, Category: Raspberry Pi Sample Projects, File: T6C238M1740.htm, ID: 1740