代码如下 我想实现 用界面调用服务器端程序 请高手指点 点 jb1 为什么不能实现启动服务器端
package com.Pb.Server;import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;public class SeverSocketTest { /**
 * 服务器
 */
public static void main(String[] args) throws Exception {
ServerSocket server =new ServerSocket(9999);
System.out.println("服务器端已经启动成功......");
try {
while(true){
Socket socket=server.accept();
new Thread(new WorkThread(socket)).start();
}
}catch(Exception e){
e.printStackTrace();
}finally{

}
server.close();
}}
class WorkThread implements Runnable{
private Socket socket;
public WorkThread(Socket socket) {
this.socket=socket;
} public WorkThread() { } public void run() {
try {
DataInputStream dis =new DataInputStream(socket.getInputStream());
//获取客户端数据
DataOutputStream dos =new DataOutputStream(socket.getOutputStream());
//返回给客户端的数据
//读客户端信息
String general=dis.readUTF();
//注册信息
if(general.equals("注册信息")){
System.out.println("注册信息");
String user1=dis.readUTF();
String password1=dis.readUTF();
String email1 = dis.readUTF();
//验证xml是否注册
try{
//查看用户是否注册
boolean b=SeekLogin.login(user1);
if (b){
dos.writeBoolean(b);
System.out.println("重复注册");
}else{
//不存在进行注册
Append.write(user1,password1,email1);
dos.writeBoolean(b);
System.out.println("注册");
}

}catch(Exception e){
e.printStackTrace();
}

}
//登录信息
if(general.equals("登陆")){
String user1 = dis.readUTF();
String password1 = dis.readUTF();
try{
System.out.println("验证用户名和密码");
String s =Information.login(user1,password1);//验证用户名和密码
System.out.println(s);
if(s.equals("true")){
dos.writeUTF(s);//返回字符串true给客户端

//读xml文档
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder db=factory.newDocumentBuilder();
InputStream is=new FileInputStream("src/com/Pb/Server/Image.xml");
org.w3c.dom.Document doc=db.parse(is);
//获得专辑介绍信息
org.w3c.dom.Node information  = doc.getElementsByTagName("information").item(0);
//得到information第一个元素
org.w3c.dom.Node infor = information.getFirstChild();
//得到第一个节点中的文本内容,相当于子节点
dos.writeUTF(infor.getNodeValue());
//获得图片信息
org.w3c.dom.Node picture  = doc.getElementsByTagName("picture").item(0);
//得到picture第一个元素
org.w3c.dom.Node pt = picture.getFirstChild();
dos.writeUTF(pt.getNodeValue());
//获得专辑曲目信息
org.w3c.dom.Node song  = doc.getElementsByTagName("song").item(0);//得到song第一个元素
org.w3c.dom.Node so = song.getFirstChild();
dos.writeUTF(so.getNodeValue());
is.close();
//获得歌曲列表信息
org.w3c.dom.Node songlist  = doc.getElementsByTagName("songlist").item(0);//得到songlist第一个元素
org.w3c.dom.Node songlist1 = songlist.getFirstChild();
//得到服务器端歌曲的路径
String sg = songlist1.getNodeValue(); 
String ff=FileDemo.songlist();
System.out.println("music"+ff);

dos.writeUTF(ff);//发送给客户端
is.close();
}else{
dos.writeUTF(s);//返回字符串false给客户端
}

}catch(Exception e){
e.printStackTrace();
}
}
//下载歌曲、歌曲大小
if(general.equals("我要下载歌曲")){
System.out.println("下载歌曲");
String st = dis.readUTF();
System.out.println(st);
DataInputStream bot= new DataInputStream(new FileInputStream("src/com/Pb/Server/"+st));

File ff = new File("src/com/Pb/Server/"+st);
int size = (int)ff.length();
dos.writeInt(size);

byte[] buffer=new byte[1024]; 
while((bot.read(buffer))!=-1)
{
//                       dos.write(buffer,0,i);
}
dos.flush();
bot.close();
}
System.out.println(socket.getInetAddress() + "-----" + general);
dis.close();
dos.close();
socket.close();

} catch (IOException e) {
e.printStackTrace();
}
}

}
界面程序:package com.Pb.Server;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
//服务器控制界面 
@SuppressWarnings("serial")
public class Server_UI extends JFrame implements ActionListener{
JPanel jp1;
JButton jb1,jb2;

public Server_UI(){
jp1=new JPanel();
jb1=new JButton("启动服务器");
jb1.addActionListener(this);
jb2=new JButton("关闭服务器");
jb2.addActionListener(this);
jp1.add(jb1);
jp1.add(jb2);

this.add(jp1);
this.setSize(500, 400);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public static void main(String[] args) {
@SuppressWarnings("unused")
Server_UI msu=new Server_UI();
} @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==jb1){
new SeverSocketTest();
}else if(e.getSource()==jb2){
this.dispose();
}

}
}