JavaÍøÂçÁÄÌì·þÎñÆ÷¶Ë
//JavaÍøÂçÁÄÌì·þÎñÆ÷
import java.io.*;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.awt.event.*;
public class ServerFrame extends Frame implements ActionListener{
int ScreenWidth,ScreenHeight;
Button CloseServer;
TextArea ServerStatus;
ServerThread sThread;
public ServerFrame(){
super("ÓÎÏ··þÎñÆ÷");
ServerStatus = new TextArea();
CloseServer = new Button("¹Ø±Õ·þÎñÆ÷");
ServerStatus.setEditable(false);
CloseServer.addActionListener(this);
add(ServerStatus,BorderLayout.CENTER);
add(CloseServer,BorderLayout.SOUTH);
ScreenWidth = getToolkit().getScreenSize().width;
ScreenHeight = getToolkit().getScreenSize().height;
setSize(ScreenWidth/2,ScreenHeight /2);
setLocation((ScreenWidth - getWidth())/2,
(ScreenHeight - getHeight())/2);
setResizable(false);
setVisible(true);
sThread = new ServerThread(this);
sThread.start();
}
public static void main(String[] args){
new ServerFrame();
}
public void actionPerformed(ActionEvent e){
dispose();
System.exit(0);
}
}
class ServerThread extends Thread{
int sPort;
ServerSocket sSocket;
ServerFrame frame;
TextArea sStatus;
Vector Clients;
Vector messages;
BroadCast BroadCastWriter;
CleanDeadConnect Cleaner;
public ServerThread(ServerFrame f){
Clients = new Vector();
messages = new Vector();
try{
sPort = 6633;
sSocket = new ServerSocket(sPort);
}catch(IOException E){
System.out.println("·¢ÉúÒì³£: "+E);
System.out.println("ÎÞ·¨½¨Á¢·þÎñÆ÷½Ó¿Ú£¡£¡");
System.exit(1);
}
this.frame = f;
sStatus = frame.ServerStatus;
sStatus.append("ÓÎÏ··þÎñÆ÷ÒÑÆô¶¯..\n\n"
Ïà¹ØÎĵµ£º
oracle
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String user="scott";
String password="tiger";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_S ......
Éî¿ÌÀí½âJava±à³ÌµÄ7¸öÀý×Ó Ù¡Ç¿ 2009Äê11ÔÂ7ÈÕ http://blog.csdn.net/microtong
1. ÔĶÁÏÂÁдúÂë»Ø´ðÎÊÌ⣨µÚÒ»¸öJava³ÌÐò£¬Àí½âPATHºÍCLASSPATH£¬Ñ§»áʹÓÃjavacºÍjavaÃüÁ
view plaincopy to clipboardprint?
package cn.edu.uibe;
public class HelloWorld {
......
ÔËÐÐÓ¦ÓóÌÐòÓëÔËÐÐweb³ÌÐòÔÀíÊÇÒ»Öµģ¬Ö»²»¹ýwebÓ¦ÓóÌÐòÒѾÔÚÆô¶¯Ê±½«³ÌÐòÔËÓõÄjar°üÉèÖõ½»·¾³±äÁ¿ÀӦÓóÌÐò¿ÉÒÔ×Ô¼ºÐ´¸öÅú´¦ÀíÀ´ÉèÖû·¾³±äÁ¿£º
java -classpath ./lib/application.jar;./lib/hibernate3.jar -Xms608m -Xmx608m com.zyj.application.StartUp
pause/exit
ÆäÖÐapplication.jarΪӦÓóÌÐòµÄjar° ......
¶¨Òå°´Öµ´«µÝºÍ°´ÒýÓô«µÝÕâÁ½¸öÊõÓïÊÇÖØÒªµÄ¡£
°´Öµ´«µÝÒâζ×ŵ±½«Ò»¸ö²ÎÊý´«µÝ¸øÒ»¸öº¯Êýʱ£¬º¯Êý½ÓÊÕµÄÊDzÎÊýµÄÒ»¸ö¸±±¾¡£Òò´Ë£¬Èç ¹ûº¯ÊýÐÞ¸ÄÁ˸òÎÊý£¬½ö¸Ä±ä¸±±¾£¬¶øÔʼֵ±£³Ö²»±ä¡£°´ÒýÓô«µÝÒâζ×ŵ±½«Ò»¸ö²ÎÊý´«µÝ¸øÒ»¸öº¯Êýʱ£¬º¯Êý½ÓÊÕµÄÊDzÎÊýµÄÄÚ´æµØÖ·£¬¶ø²»ÊDzÎÊýµÄ¸±±¾¡£Òò ´Ë£¬Èç¹ûº¯ÊýÐÞ¸ÄÁ˸òÎÊý£¬µ÷ ......
ÈÕ³£²Ù×÷Öг£¼ûµÄÅÅÐò·½·¨ÓУºÃ°ÅÝÅÅÐò¡¢¿ìËÙÅÅÐò¡¢Ñ¡ÔñÅÅÐò¡¢²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£¬ÉõÖÁ»¹ÓлùÊýÅÅÐò¡¢¼¦Î²¾ÆÅÅÐò¡¢Í°ÅÅÐò¡¢¸ë³²ÅÅÐò¡¢¹é²¢ÅÅÐòµÈ¡£
ðÅÝÅÅÐòÊÇÒ»ÖÖ¼òµ¥µÄÅÅÐòËã·¨¡£ËüÖظ´µØ×߷ùýÒªÅÅÐòµÄÊýÁУ¬Ò»´Î±È½ÏÁ½¸öÔªËØ£¬Èç¹ûËûÃǵÄ˳Ðò´íÎó¾Í°ÑËûÃǽ»»»¹ýÀ´¡£×ß·ÃÊýÁеŤ×÷ÊÇÖظ´µØ½øÐÐÖ±µ½Ã»ÓÐÔÙÐèÒª½» ......