Chapter 10 Application Programmer’s Interface
10-20 ER1 User Guide
Download Java SDK
To compile the Client java script and the Test script (as well as any scripts you write
yourself), you need the latest Java SDK. Here is the URL where you can download what
you need to run your java scripts in Windows:
http://java.sun.com/downloads/index.html
This provides a Java compiler for *.java text program files (TestClient.java and
ER1Client.java). The compiler takes the text program files as input and creates
*.class files. You can then use the Java runtime environment to execute the files.
Each time you edit your
*.java file, you must use the compiler to recompile it.
Compiling
After downloading and installing the latest Java SDK, you can compile the Client script
and the Test script by typing the following at the C:\ command line (don’t forget to take
directory paths into account):
javac ER1Client.java
javac TestClient.java
For example:
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:\>cd ER1
C:\ER1>dir *Client*
10/07/2002 08:58a 8,115 ER1Client.java
10/07/2002 08:58a 1,496 TestClient.java
C:\ER1>c:\j2sdk1.4.1\bin\javac ER1Client.java
C:\ER1>c:\j2sdk1.4.1\bin\javac TestClient.java
C:\ER1>dir *Client*
10/07/2002 05:04p 4,569 ER1Client.class
10/07/2002 08:58a 8,115 ER1Client.java
10/07/2002 06:10p 719 TestClient.class
10/07/2002 08:58a 1,496 TestClient.java
Running the Script
To run the compiled
TestClient Java script:
1. Put the robot’s laptop into remote API mode as described earlier.
2. On your Client machine, use telnet to log into the robot’s laptop.
3. Type the following at the command line:
java TestClient -a XX.X.XX. XXX
where XX.X.XX.XXX is the robot laptop’s IP address, for example:
java TestClient -a 10.1.3.108
4. You should see:
C:\ER1>c:\j2sdk1.4.1\bin\java TestClient -a 10.1.3.111
Sending command: move 10 i
Response: OK
Sending command: events
Response: OK