To test the Chat Room application:
Download and install the free implementation of the Jabber Server from the following URL:
http://www.jabberstudio.org/projects/ejabberd/releases/view.php?id=610
Set the path of the bin directory of J2SDK by executing the following command at the command prompt:
set path=%path%;D:\j2sdk1.4.0_02\bin;
Set the classpath of the lib directory of J2SDK by executing the following command at the command prompt:
set classpath=%classpath%;D:\j2sdk1.4.0_02\lib;
Copy the LoginGUI.java, MainGUI.java, ChatRoom.java, RoomInformation.java, GroupChat.java, and SocketOpener.java files to a folder on your computer. Use the cd command at the command prompt to move to the folder in which you have copied the Java files. Compile the files by using the following javac command, as shown:
javac *.java
To run the Chat Room application, specify the following command at the command prompt:
java LoginGUI
The Login window of the Chat Room application appears. Specify the login information, as shown in Figure 3-8:
Figure 3-8: Specifying Login Information
Click the Submit button to send the login information to the Jabber server for registered end users or open a new account in the Jabber server for unregistered end users.
The user interface of the Chat Room application appears. Select File-> Go to Chat Room to specify the name of the chat room to join.
Enter the name of the chat room and the user name to join the chat room, as shown in Figure 3-9:
Figure 3-9: Entering a Chat Room
Click the Submit button to open the Group Chat window of the specified chat room, as shown in Figure 3-10:
Figure 3-10: The Group Chat Window of the Specified Chat Room
To create a chat room, select File-> Create New Chat Room from the user interface of the Chat Room application.
Enter the name of the chat room and the user name, as shown in Figure 3-11:
Figure 3-11: Entering Chat Room Name and User Name
Click the Submit button to create a new chat room and open the Group Chat window of the new chat room, as shown in Figure 3-12:
Figure 3-12: The Group Chat Window of the New Chat Room
Type the required message in the chat window and click the Send button to send the message to all end users logged in to the chat room, as shown in Figure 3-13:
Figure 3-13: Sending a Message
To initiate a group chat, select any chat room from the Existing Rooms tree structure of the Chat Room application, as shown in Figure 3-14:
Figure 3-14: Selecting an Existing Room
The Input Dialog box appears to specify the user name for the selected chat room, as shown in Figure 3-15:
Figure 3-15: The Input Dialog Box
Enter the user name and click the OK button. The Group Chat window for the selected room appears, as shown in Figure 3-16:
Figure 3-16: The Group Chat Window of the Selected Chat Room