How to compile your own aglet.
The purpose of this document is to describe
how to make "your own aglet."
This guide provides an example scenario for compiling and starting your own
aglet.
Preparation (required)
You need to install
- JDK 1.1 or later
- ASDK 1.1b2
Please refer Installation Guide to learn
how to install ASDK and develop an aglet.
Stories
When you compile an aglet, the setting of your environment variables
are different from that for Tahiti execution.
Set-up guides are available for
Working with Aglet
Windows 95/Windows NT
Assumptions on your Environment
1) You have installed JDK1.1.8 in
C:\jdk1.1.8,
2) ASDK1.1b2 in
C:\Aglets1.1b2,
and
3) working directory is
d:\work.
1. Create Aglet's source code
Set current directory as d:\work.
The name of your first aglet is "MyAglet" and the name of its package
is specified as "trial".
Create a file whose name os "MyAglet.java" and input text.
package trial;
import com.ibm.aglet.*;
public class MyAglet extends Aglet {
public void run() {
System.out.println("Hello, world!");
}
}
2. Compile the source code
After you save the file. You can compile it by executing the following
commands.
Command:
D:\work> set CLASSPATH=C:\jdk1.1.8\lib\classes.zip;C:\Aglets1.1b2\lib\aglets.jar
D:\work> C:\jdk1.1.8\bin\javac -d C:\Aglets1.1b2\public -classpath %CLASSPATH%;C:\Aglets1.1b2\public;.
Then a file "
MyAglet.class" is created in the
C:\Aglets1.1b2\public\trial\
directory.
3. Execution
Start
Tahiti
in a different session and create your aglet by specifying its name as
"trial.MyAglet".
After creating aglet, you can find a string "Hello, world!" on the
console.
SPARC/Solaris, x86/Solaris, AIX
Assumptions on your Environment
1) You have installed JDK1.1.8 in
/usr/local/jdk1.1.8
,
2) ASDK1.1b2 in
$HOME/Aglets1.1b2
, and
3) working directory is
$HOME/work.
1. Create Aglet's source code
Set current directory as $HOME/work.
The name of your first aglet is "MyAglet" and the name of its package
is specified as "trial".
Create a file whose name os "MyAglet.java" and input text.
package trial;
import com.ibm.aglet.*;
public class MyAglet extends Aglet {
public void run() {
System.out.println("Hello, world!");
}
}
2. Compile the source code
After you save the file. You can compile it by executing the following
commands.
Command:
% setenv CLASSPATH $HOME/jdk1.1.8/lib/classes.zip:$HOME/Aglets1.1b2/lib/aglets.jar
% /usr/local/jdk1.1.8/bin/javac -d $HOME/Aglets1.1b2/public -classpath $CLASSPATH:$HOME/Aglets1.1b2/public:.
Then a file "
MyAglet.class"
is created in the
$HOME/Aglets1.1b2/public/trial/
directory.
3. Execution
Start
Tahiti in a different session and create your aglet
by specifying its name as "trial.MyAglet".
After creating aglet, you can find a string "Hello, world!" on the
console.
MacOS