I've got your message. Sorry to hear that you are using a pirated copy of the book. And complaining about it too ...
Does the material you have include the example applications as well or just the code snippets in the book? Of course code snippets are intended for reading only, it is the example applications that are the ones you should be building and executing.
To me this code looks really complete, I'm sure the entire example would build if only I would have the compiler. Note the import packages too ...
Code:
package com.Series40Book;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import java.util.*;
public class PhotoViewer extends MIDlet
implements CommandListener {
private Display display;
private Command next;
private Command exit;
private Command start;
private Command stop;
private Form imageForm;
private String [] imageNames;
private String [] imageFileNames;
private int imageIdx;
private Timer autoShowTimer;
boolean exitConfirmed;
public PhotoViewer () { ...