ビデオ会議用のサーバーを起動しようとしていますが、実行中にエラーが発生します..どこが間違っているのか、クライアントが私に接続するためにサーバーを起動する方法を教えてください..
package chat;
import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Event;
import java.awt.Frame;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Label;
import java.awt.List;
import java.awt.MediaTracker;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.TextArea;
import java.awt.TextComponent;
import java.awt.Toolkit;
import java.awt.Window;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
public class ChatServer extends Frame
{
static final int DEFAULT_USERCOUNT = 3;
static final int DEFAULT_PORT = 10000;
static final String ICON_FILE = "icon.gif";
int num_Line = 0;
User[] users = null;
User_webBrowser[] users_webBrowser = null;
User_Video[] users_Video = null;
User_Audio[] users_Audio = null;
ServerSocket ss = null;
ServerSocket ss1 = null;
ServerSocket ss2 = null;
ServerSocket ss3 = null;
RoomGroup roomGroup = null;
int port = 10000;
Image icon = null;
String IP = null;
TextArea message_TextArea;
List users_List;
Choice room_Choice;
Label message_Label;
Label room_Label;
Label userList_Label;
Button clean_Button;
MenuBar mainMenuBar;
Menu menu1;
Menu menu3;
void initServer(int port)
throws IOException
{
this.users = new User[3];
this.users_webBrowser = new User_webBrowser[3];
this.users_Video = new User_Video[3];
this.roomGroup = new RoomGroup(3, this.room_Choice, this);
try {
this.ss = new ServerSocket(port, 5);
this.ss1 = new ServerSocket(port + 1, 5);
this.ss2 = new ServerSocket(port + 2, 5);
this.ss3 = new ServerSocket(port + 3, 5);
this.message_TextArea.appendText(
"\nserver socket init successed");
}
catch (Exception e) {
System.out.println(e);
this.message_TextArea.appendText(
"\nserver socket init error" + e);
}
for (int i = 0; i < this.users.length; i++)
{
this.users[i] = new User(this, i);
this.users_webBrowser[i] = new User_webBrowser(this, i);
this.users_Video[i] = new User_Video(this, i);
}
this.roomGroup.setUsers(this.users);
show();
go();
this.message_TextArea.appendText("\nserver started");
}
ChatServer(int port)
throws IOException
{
this.icon = getToolkit().getImage("icon.gif");
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(this.icon, 0);
try {
tracker.waitForAll();
} catch (Exception e) {
System.out.println(e);
}
setLayout(null);
addNotify();
resize(insets().left + insets().right + 544, insets().top + insets().bottom + 355);
setTitle("Video conference system server V1.0");
setIconImage(this.icon);
setBackground(new Color(14542583));
this.message_TextArea = new TextArea();
this.message_TextArea.reshape(insets().left + 12,
insets().top + 36, 396, 240);
add(this.message_TextArea);
this.users_List = new List(5, false);
add(this.users_List);
this.users_List.reshape(insets().left + 432, insets().top +
144, 76, 110);
this.room_Choice = new Choice();
add(this.room_Choice);
this.room_Choice.reshape(insets().left + 420, insets().top +
60, 100, 1);
this.message_Label = new Label("Server Message");
this.message_Label.reshape(insets().left + 36, insets().top +
12, 100, 24);
add(this.message_Label);
this.room_Label = new Label("Meeting Room");
this.room_Label.reshape(insets().left + 420, insets().top +
14, 100, 24);
add(this.room_Label);
this.userList_Label = new Label("User Lists");
this.userList_Label.reshape(insets().left + 420, insets().top +
108, 100, 28);
add(this.userList_Label);
this.clean_Button = new Button("Remove");
this.clean_Button.reshape(insets().left + 180, insets().top +
12, 60, 24);
add(this.clean_Button);
this.mainMenuBar = new MenuBar();
this.menu1 = new Menu("File");
this.menu1.add("Restart");
this.menu1.add("Quit");
this.mainMenuBar.add(this.menu1);
this.menu3 = new Menu("Help");
this.mainMenuBar.setHelpMenu(this.menu3);
this.menu3.add("About");
this.mainMenuBar.add(this.menu3);
setMenuBar(this.mainMenuBar);
this.port = port;
initServer(port);
}
ChatServer()
throws IOException
{
this(10000);
}
void cleanButton_Clicked(Event event)
{
this.message_TextArea.setText("");
}
void About_Action(Event event)
{
new AboutDialog(this, true).show();
}
void Exit_Action(Event event)
{
new QuitDialog(this, true).show();
}
void Restart_Action(Event e)
{
try {
quit();
initServer(this.port);
} catch (Exception e1) {
this.message_TextArea.appendText("\ninit server error");
}
}
public synchronized void show()
{
move(50, 50);
super.show();
}
void roomChoice_Action(Event e)
{
String roomName = null;
int roomID = 0;
this.users_List.clear();
roomName = this.room_Choice.getSelectedItem();
roomID = this.roomGroup.getRoomID(roomName);
for (int i = 0; i < this.users.length; i++)
if ((this.users[i].logged) && (this.users[i].belongRoom) &&
(this.users[i].roomID == roomID))
this.users_List.addItem(this.users[i].name);
}
int roomNum()
{
String roomName = null;
int roomID = 0;
this.users_List.clear();
roomName = this.room_Choice.getSelectedItem();
roomID = 0;
int k = 0;
for (int i = 0; i < this.users.length; i++) {
if ((this.users[i].logged) && (this.users[i].belongRoom) &&
(this.users[i].roomID == roomID)) {
this.users_List.addItem(this.users[i].name);
k++;
}
}
return k;
}
public boolean handleEvent(Event event)
{
if (event.id == 201) {
quit();
hide();
dispose();
System.exit(0);
return true;
}
if ((event.target == this.room_Choice) && (event.id ==
1001)) {
roomChoice_Action(event);
return true;
}
if ((event.target == this.clean_Button) && (event.id ==
1001)) {
cleanButton_Clicked(event);
return true;
}
return super.handleEvent(event);
}
public boolean action(Event event, Object arg)
{
if ((event.target instanceof MenuItem)) {
String label = (String)arg;
if (label.equalsIgnoreCase("About")) {
About_Action(event);
return true;
}
if (label.equalsIgnoreCase("Quit")) {
Exit_Action(event);
return true;
}
if (label.equalsIgnoreCase("Restart")) {
Restart_Action(event);
return true;
}
}
return super.action(event, arg);
}
public static void main(String[] args)
{
try
{
chatServer = new ChatServer();
}
catch (Exception e)
{
ChatServer chatServer;
System.out.println(e);
}
}
public void go()
{
for (int i = 0; i < this.users.length; i++) {
this.users[i].start();
this.users_webBrowser[i].start();
this.users_Video[i].start();
}
}
public void quit()
{
for (int i = 0; i < this.users.length; i++) {
if (this.users[i] != null) this.users[i].destroy();
if (this.users_webBrowser[i] != null) this.users_webBrowser[i].destroy();
if (this.users_Video[i] != null) this.users_Video[i].destroy();
}
try
{
this.ss.close();
this.ss = null;
this.ss1.close();
this.ss1 = null;
this.ss2.close();
this.ss2 = null;
this.ss3.close();
this.ss3 = null;
this.room_Choice.removeAll();
this.users_List.clear();
this.message_TextArea.appendText(
"\nserver socket closed");
}
catch (IOException e) {
System.out.println(e);
}
}
}
スタックトレース
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
chatServer cannot be resolved to a variable
at chat.ChatServer.main(ChatServer.java:275)