Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java³ÌÐòÖÐǶÈëtomcat·þÎñÆ÷

   Ò»°ãÇé¿öÏ£¬¶¼Êǽ«Java³ÌÐò´ò°ü³ÉwarÎļþ²¿ÊðÔÚtomcatÈÝÆ÷ÖС£µ«ÒòÎªÒ»Ð©ÌØ±ðÔ­Òò(ÀýÈçÕû¸ö³ÌÐòÖ±½Ó´ò°ü·¢²¼¸øÓû§Ê¹ÓÃ)£¬ÓÐʱϣÍûÄÜÔÚjavaÖÐǶÈëtomcat·þÎñÆ÷¡£
   tomcat ¹Ù·½Ìṩһ¸öרÓÃµÄ embed °æ±¾£¬Ä¿Ç°×îа汾Ϊ5.5 (²»ÖªÊ²Ã´Ô­Òò,tomcat6µÄembed°æ±¾ÉÐδÕýʽ·¢²¼)¡£¿ÉÒÔͨ¹ý http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.28/bin/apache-tomcat-5.5.28-embed.tar.gz
½øÐÐÏÂÔØ¡£
   ½âѹ Tomcat
Embed °æ±¾ºó£¬½«Æä lib Ŀ¼ÏÂËùÓÐ .jar Îļþ¼ÓÈëµ½ Java ÏîÄ¿µÄ classpath ÖУ¬¼´¿É¿ªÊ¼¿ª·¢¡£
   ÒÔÏÂÊǸöʾÀý´úÂ룺
package test;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.catalina.*;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.realm.MemoryRealm;
import org.apache.catalina.startup.Embedded;
public class EmbeddedTomcat {
private EmbeddedTomcat(Embedded tomcat,
String listenIP, int listenPort)
{
this.tomcat = tomcat;
this.listenIP = listenIP;
this.listenPort = listenPort;
}

public static EmbeddedTomcat startup(String catalinaHome, String warFileName,
int listenPort, boolean enableRemoteAccess)
{
System.setProperty("catalina.home", catalinaHome);

// ¼àÌýIP»ñÈ¡
String listenIP;
try {
listenIP = (enableRemoteAccess ? InetAddress.getLocalHost().getHostAddress() : "127.0.0.1");
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
// war Îļþ¼ì²â
String contextName;
int tn = warFileName.lastIndexOf('\\');
if (tn < 0) {
contextName = warFileName;
warFileName = catalinaHome + "/webapps/" + warFileName;
}
else {
contextName = warFileName.substring(tn+1);
}
File warFile = new File(warFileName);
if (! warFile.exists())
throw new RuntimeException("File '"+ warFileName +"' does'nt exist.");
if (warFileName.endsWi


Ïà¹ØÎĵµ£º

Javaѧϰ±Ê¼Ç1

 Ò»¡¢JavaÔËÐÐʱµÄÁ½ÖÖºËÐÄ»úÖÆ
     £¨1£©JavaÐéÄâ»ú£¨Java Virtual Machine£©
               ÓÃÀ´´¦ÀíJavaÔ´Îļþ±àÒëºóµÄ×Ö½ÚÂ룬ÆÁ±Îµ×²ãÔËÐÐÆ½Ì¨µÄ²îÒ죬ʵÏÖ“Ò»´Î±àÒë£¬Ëæ´¦Ö´ÐД£¬¶øÇÒ²»Í¬µÄÔËÐÐÆ ......

JavaÐéÄâ»ú(JVM)¼°ÆäÄÚ´æ·ÖÅäµÄÉèÖÃ

°²×°Java¿ª·¢Èí¼þʱ£¬Ä¬Èϰ²×°°üº¬Á½¸öÎļþ¼Ð£¬Ò»¸öJDK(Java¿ª·¢¹¤¾ßÏä)£¬Ò»¸öJRE(JavaÔËÐл·¾³£¬ÄÚº¬JVM)£¬ÆäÖÐJDKÄÚÁíº¬Ò»¸öJRE¡£Èç¹ûÖ»ÊÇÔËÐÐJava³ÌÐò£¬ÔòJREÒÑ×ã¹»£»¶øJDKÔòÖ»Óпª·¢ÈËÔ±²ÅÓõ½¡£
Ò»¡¢JVMÄÚ´æ·ÖÅäÉèÖÃ
1. JVMÄÚ´æ·ÖÅäÉèÖõIJÎÊýÓÐËĸö£º
-Xmx    Java Heap×î´óÖµ£¬Ä¬ÈÏֵΪÎïÀíÄÚ´æµÄ ......

¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ5ÕÂ


µÚ5ÕÂͼÐνçÃæÉè¼Æ(Ò»)
(Ò»)¿Î³ÌÄÚÈÝ
5.1 ͼÐνçÃæÉè¼Æ»ù´¡
5.1.1 AWI’ºÍSwing
5.1.2×é¼þºÍÈÝÆ÷
5.1.3ʼþÇý¶¯³ÌÐòÉè¼Æ»ù´¡
5.2¿ò¼Ü´°¿Ú .
5.3±êÇ©¡¢°´Å¥ºÍ°´Å¥Ê¼þ
5.3.1 ±êÇ©
5.3.2°´Å¥ºÍ°´Å¥Ê¼þ´¦Àí
5.4Ãæ°å
5.4.1 JPanel
5.4.2 JScrollPane
5.5²¼¾ÖÉè¼Æ
5.5.1 FlowI.ayout²¼¾Ö
5.5.2 BorderI.a ......

JavaÿÌìѧϰһµãµã 09.10.14

                                                   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ