Using Java on Linux

Laboratory Exercise 3

CMP 420: Database Systems
Lehman College, City University of New York
27 February 2003


Unix Commands

Each lab begins with several Unix commands that will be useful for completing today's lab and future labs and assignments. Try the following commands:

Using Java

Today's lab focuses on using Java on the Linux systems. Installed on the lab machines is the Java Developer's Toolkit (JDK 1.2.2), a standard release from Sun Microsystems.

Applets

Now, make an applet that will print "Hello World" in red letters on a blue background. As in other systems, you will need to create an HTML file for you applet. Compile your file as before and save your HTML file as hello.html. To view your applet, you can load the webpage into a browser (as you did on other systems), or you can use a program designed for viewing applets, called appletviewer. To use appletviewer, you type:
    appletviewer hello.html

Add to your applet, 3 buttons that change the background color.

If you have forgotten some of your java, the API's on the Sun webpages are at: http://java.sun.com/products/jdk/1.2/docs/api/index.html.

Final Comments

Before leaving the lab, you need to log out and shut down your computer. First, you should quit all applications. Then, go to the K menu in the bottom left hand corner and select Log Out. Choose the Shut Down option, and shut off the monitor when you're done.

Remember to pick up any files you sent to the printer and to take any personal belongings. It is difficult to get back into the lab later (since it's locked when not in use), so, it's worth making sure you haven't forgotten anything.