Search

Showing posts with label Hello World. Show all posts
Showing posts with label Hello World. Show all posts

Hello World

View Comments

Here are the steps to creating my HelloWorld.
I have run setenv in the previous set(previous blog)
If your are starting with a fresh command prompt, run it using the previous blog entry as reference.

1. Create a directory HelloWorld under C:\Lejos\Project
2. Create a file HelloWorld.java with the following lines. This program can also be found in

      import josx.platform.rcx.*;

/**
* @author calvinedu">Ryan VanderBijl
*/

/* This class uses char[] to display text on the LCD.
* Strings aren't really supported by TinyVM. :-(
*
* This program, after d/ling, waits for you to press the RUN
* button, and then displays "hello", for a small delay, and then
* displays "world". (Then a small delay, and then it returns to
* the TinyVM OS).
*/

public class HelloWorld
{
public static void main (String[] aArg)
throws Exception
{
LCD.clear();
TextLCD.print ("hello");
Thread.sleep(2000);
TextLCD.print ("world");
Thread.sleep(2000);
}
}
Go to this link and follow the directions on how to build download and run it.

Here is my output
...........................................................................................
c:\>cd C:\Lejos\Project
C:\Lejos\Project>mkdir HelloWorld
C:\Lejos\Project\HelloWorld>lejosjc.bat HelloWorld.java
C:\Lejos\Project\HelloWorld>lejoslink.bat -o HelloWorld.bin HelloWorld
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
Warning: Can't open zip/jar file: C:\Lejos/lib/classes.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcxport.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\BlackBox.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\rcx.jar
Warning: Can't open zip/jar file: C:\Lejos\lejos\lib\comm.jar
C:\Lejos\Project\HelloWorld>
C:\Lejos\Project\HelloWorld>dir
Volume in drive C has no label.
Volume Serial Number is F0CC-206D

Directory of C:\Lejos\Project\HelloWorld

C:\Lejos\Project\HelloWorld>
C:\Lejos\Project\HelloWorld>dir
Volume in drive C has no label.
Volume Serial Number is F0CC-206D

Directory of C:\Lejos\Project\HelloWorld

04/04/2005 11:03 PM .
04/04/2005 11:03 PM ..
04/04/2005 11:03 PM 2,789 HelloWorld.bin
04/04/2005 11:02 PM 554 HelloWorld.class
04/04/2005 11:02 PM 658 HelloWorld.java
3 File(s) 4,001 bytes
C:\Lejos\Project\HelloWorld>lejosdl.bat HelloWorld.bin
C:\Lejos\Project\HelloWorld>
NOW press the red button to display 'Hello' on the LCD of the RCX. The 'World' will come a couple of seconds later,


Read more...