I am working with mobile agents, i got two .java files: HelloAglet.java and MyDialog.java
they both depend on each other, i put them both on the desktop (same directory) and im trying to compile them using the following command:


%JDK_HOME%\bin\javac -d %AGLET_HOME%\public -classpath %CLASSPATH% *.java

and im getting the following errors:

MyDialog.java:44: cannot find symbol
Symbol : class HelloAglet
Location: class Simple.MyDialog
private HelloAglet aglet = null;
^
MyDialog.java:59: cannot find symbol
Symbol : class HelloAglet
Location: class Simple.MyDialog
MyDialog(HelloAglet aglet) {
^
HelloAglet.java:87: cannot find symbol
Symbol : class MyDialog
Location: class simple.HelloAglet
my_dialog = new MyDialog(this);
^
HelloAglet.java:102: cannot find symbol
Symbol : class MyDialog
Location: class simple.HelloAglet
my_dialog = new MyDialog(this);

i will provide both codes:

package simple;

/*
 * @(#)HelloAglet.java
 * 
 * 03L7246 (c) Copyright IBM Corp. 1996, 1998
 * 
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

import com.ibm.aglet.*;
import com.ibm.aglet.event.*;
import com.ibm.aglet.Message;
import com.ibm.aglet.util.*;

import com.ibm.agletx.util.SimpleItinerary;



import java.lang.InterruptedException;
import java.io.Externalizable;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.IOException;
import java.net.*;
import java.awt.*;

import java.awt.event.*;
import java.util.Enumeration;

/**
 * <tt> HelloAglet </tt> is a mobile aglet that goes to a remote host
 * to say "Hello World" and then returns home and dies.
 * <p>1. Shows a dialog box to specify the destination server.
 * invoke handleMessage() methods.
 * <p>2. (Execution of "startTrip" message) Moves to the destination server
 * and send "sayHello" message.
 * to itself.
 * <p>3. (Execution of "sayHello" message) Display a string for 5 secs
 * and go back to the origin. Send "atHome" message to itself.
 * <p>4. (Execution of "atHome" message) Display a string "I'm back"
 * for 2 secs and destroy itself.
 * 
 * @version     1.00    $Date: 2005/11/07 11:38:10 $
 * @author      Danny B. Lange
 * @author      Mitsuru Oshima
 */
public class HelloAglet extends Aglet {

	/*
	 * UI to interact with a user
	 * this will be automatically disposed when the aglet is disposed
	 */
	transient Frame my_dialog = null;		// not serialized

	/*
	 * message
	 */
	String message = null;

	/*
	 * home address represented as a string
	 */
	String home = null;

	/*
	 * Itinerary
	 */
	SimpleItinerary itinerary = null;

	/*
	 * Reports arrival home and disappears
	 */
	public void atHome(Message msg) {
		setText("I'm back.");		// greetings
		waitMessage(2 * 1000);		// show message, 2 seconds
		dispose();					// dispose it self
	}
	protected void createGUI() {
		my_dialog = new MyDialog(this);

		my_dialog.pack();
		my_dialog.setSize(my_dialog.getPreferredSize());
		my_dialog.setVisible(true);
	}
	/**
	 * Creates and shows the dialog window.
	 * This aglet keeps the reference to the instance
	 * of the Dialog to avoid opening multiple dialog windows.
	 */
	public void dialog(Message msg) {

		// check and create a dialog box
		if (my_dialog == null) {
			my_dialog = new MyDialog(this);
			my_dialog.pack();
			my_dialog.setSize(my_dialog.getPreferredSize());
		} 

		// show the dialog box
		my_dialog.setVisible(true);
	}
	/*
	 * Handles the message
	 * @param msg the message sent
	 */
	public boolean handleMessage(Message msg) {
		if (msg.sameKind("atHome")) {
			atHome(msg);
		} else if (msg.sameKind("startTrip")) {
			startTrip(msg);
		} else if (msg.sameKind("sayHello")) {
			sayHello(msg);
		} else if (msg.sameKind("dialog")) {
			dialog(msg);
		} else {
			return false;
		} 
		return true;
	}
	/*
	 * Initializes the aglet.
	 * Only called the very first time this aglet is created.
	 */
	public void onCreation(Object init) {
		setMessage("Hello World!");		// default message

		// Create GUI to control this Aglet
		createGUI();
		itinerary = new SimpleItinerary(this);

		// Initialize the variable.
		home = getAgletContext().getHostingURL().toString();
	}
	/*
	 * Say hello!
	 */
	public void sayHello(Message msg) {
		setText(message);			// greetings
		waitMessage(5 * 1000);		// show message, 5 seconds

		// try back home
		try {
			setText("I'll go back to.. " + home);
			waitMessage(1000);		// 1 second

			// Go back home and Send "atHome" message to owner this
			itinerary.go(home, "atHome");
		} catch (Exception ex) {
			ex.printStackTrace();
		} 
	}
	/*
	 * Set the message
	 * @param message the message to send
	 */
	public void setMessage(String message) {
		this.message = message;
	}
	/**
	 * Strats the trip of this aglet to the destination.
	 */
	public synchronized void startTrip(Message msg) {

		// get the address for trip
		String destination = (String)msg.getArg();

		// Go to the destination and Send "sayHello" message to owner(this)
		try {
			itinerary.go(destination, "sayHello");
		} catch (Exception ex) {
			ex.printStackTrace();
		} 
	}
}
package Simple;

/*
 * @(#)HelloAglet.java
 * 
 * 03L7246 (c) Copyright IBM Corp. 1996, 1998
 * 
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

import com.ibm.aglet.*;
import com.ibm.aglet.event.*;
import com.ibm.aglet.Message;
import com.ibm.aglet.util.*;

import com.ibm.agletx.util.SimpleItinerary;

import java.lang.InterruptedException;
import java.io.Externalizable;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.IOException;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Enumeration;

/*
 * MyDialog class is the window to be opened when the dialog required.
 * This is NOT a subclass of Dialog.
 */
class MyDialog extends Frame implements WindowListener, ActionListener {

	/*
	 * The aglet a user interacts with.
	 */
	private HelloAglet aglet = null;

	/*
	 * UI Components
	 */
	private AddressChooser dest = new AddressChooser();
	private TextField msg = new TextField(18);
	private Button go = new Button("GO!");
	private Button send = new Button("Send CLONE!");
	private Button close = new Button("CLOSE");

	/*
	 * Constructs the dialog window
	 * @param aglet The aglet the user interacts with.
	 */
	MyDialog(HelloAglet aglet) {
		this.aglet = aglet;
		layoutComponents();

		addWindowListener(this);
		go.addActionListener(this);
		send.addActionListener(this);
		close.addActionListener(this);
	}
	/**
	 * Handles the action event
	 * @param ae the event to be handled
	 */
	public void actionPerformed(ActionEvent ae) {

		// execute "GO!" command
		if ("GO!".equals(ae.getActionCommand())) {
			aglet.setMessage(msg.getText());
			try {
				AgletProxy p = aglet.getProxy();

				p.sendOnewayMessage(new Message("startTrip", 
												dest.getAddress()));
			} catch (Exception e) {
				e.printStackTrace();
			} 
		} 

		// execute "Send CLONE!" command
		else if ("Send CLONE!".equals(ae.getActionCommand())) {
			aglet.message = msg.getText();
			try {
				AgletProxy p = (AgletProxy)aglet.clone();

				p.sendOnewayMessage(new Message("startTrip", 
												dest.getAddress()));
			} catch (Exception e) {
				e.printStackTrace();
			} 
		} 

		// execute "CLOSE" command
		else if ("CLOSE".equals(ae.getActionCommand())) {
			setVisible(false);
		} 
	}
	/*
	 * Layouts all components
	 */
	private void layoutComponents() {
		msg.setText(aglet.message);

		// Layouts components
		GridBagLayout grid = new GridBagLayout();
		GridBagConstraints cns = new GridBagConstraints();

		setLayout(grid);

		cns.weightx = 0.5;
		cns.ipadx = cns.ipady = 5;
		cns.fill = GridBagConstraints.HORIZONTAL;
		cns.insets = new Insets(5, 5, 5, 5);

		cns.weightx = 1.0;
		cns.gridwidth = GridBagConstraints.REMAINDER;
		grid.setConstraints(dest, cns);
		add(dest);

		cns.gridwidth = GridBagConstraints.REMAINDER;
		cns.fill = GridBagConstraints.BOTH;
		cns.weightx = 1.0;
		cns.weighty = 1.0;
		cns.gridheight = 2;
		grid.setConstraints(msg, cns);
		add(msg);

		cns.weighty = 0.0;
		cns.fill = GridBagConstraints.NONE;
		cns.gridheight = 1;

		Panel p = new Panel();

		grid.setConstraints(p, cns);
		add(p);
		p.setLayout(new FlowLayout());
		p.add(go);
		p.add(send);
		p.add(close);
	}
	public void windowActivated(WindowEvent we) {}
	public void windowClosed(WindowEvent we) {}
	/**
	 * Handles the window event
	 * @param we the event to be handled
	 */

	public void windowClosing(WindowEvent we) {
		dispose();
	}
	public void windowDeactivated(WindowEvent we) {}
	public void windowDeiconified(WindowEvent we) {}
	public void windowIconified(WindowEvent we) {}
	public void windowOpened(WindowEvent we) {}
}

PS: I tried compile other INDEPENDENT CLASSES, and it went well... any help is highly appreciated

that's very old API, isn't good idea

1/ remove import from MyDialog class, because isn't necessary ..., and used too

import com.ibm.agletx.util.SimpleItinerary;

2/ please there are Eclipse and Netbeans and both are free, there you can write/import, then debug/run your code more confortly as from command Line,

3/ this site (aglet) contains lots of examples

From my first glance, I do not think package 'simple' and 'Simple' are the same in Java, remember identifiers are case sensitive in Java.
Thats looks to be the reason behind the classes not able to access each others members. Not to mention your MyDialog class has default access due to which it will not be visible to any class outside the 'Simple' package even if you try to explicitly import it.

To mKorbel:

Thank you for your reply, the problem was the "package simple" and "package Simple"
but what was the site that you wanted to give me ?
you said : "3/ this site (aglet) contains lots of examples " i think you forgot to include the link , can you please ad the link again, because i really need a link that has a lot of examples about aglets

To stephen84s
Thank you for your reply, and YES that was the mistake. i corrected it and it compiled fine :))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.