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

¡¾×ª¡¿JAVA RMI ¿ìËÙÈëÃÅʵÀý

http://damies.javaeye.com/blog/51778
¹Ø¼ü×Ö: RMI
JAVA RMI ¿ìËÙÈëÃÅʵÀý
±¾ÊµÀýΪ²Î¿¼¶àƪÎÄÕÂд¾Í¶ø³É£¬ÍøÉϼ°ÊéÉϸ÷ÀàÎÄÕ½éÉÜÈçºÎʹÓÃRMIÓжàÖÖʵÀý¿É²Î¿¼£¬Æ©ÈçÓУº
1. ÓÃÃüÁîrmiregistryÆô¶¯RMI×¢²á·þÎñµÄ
2. ͬʱ´´½¨´æ¸ù(stub)ºÍ¹Ç¼Ü(skeleton)µÄ
3. Ö»´´½¨´æ¸ùÀàµÄµÄ(jdk1.2ÒÔºó°æ±¾)
4. ͨ¹ýRemoteRefºÍrmi://ЭÒé×Ö´®·½Ê½µÄ
5. ±È½ÏÉÙ½²µ½µÄÓÃLocateRegistryÖ±½ÓÔÚ´úÂëÉÏÆô¶¯RMI×¢²á·þÎñµÄ¡£
ÒÔÉÏÃèÊö²¢·ÇÃ÷ÏÔ·ÖÀ࣬±ÈÈ磬Äã×ÜÊÇ¿ÉÒÔÑ¡ÔñÓÃrmiregistry»òÕß´úÂëLocateRegistryÆô¶¯RMI×¢²á·þÎñ
ÏÂÃæÎÒ½«½éÉÜÒ»¸öÍêÕûµÄʵÀý£¬ÈóõѧÕßÄÜ¿ìËÙÌåÑéRMIµÄ¹¦Óá£
·ÖΪÒÔÏÂËĸö²½Öè
1. ´´½¨Ô¶³Ì½Ó¿Ú¼°ÉùÃ÷Ô¶³Ì·½·¨£¨HelloInterface.java£©
2. ʵÏÖÔ¶³Ì½Ó¿Ú¼°Ô¶³Ì·½·¨£¨¼Ì³ÐUnicastRemoteObject£©(Hello.java)
3. Æô¶¯RMI×¢²á·þÎñ£¬²¢×¢²áÔ¶³Ì¶ÔÏó£¨HelloServer.java£©
4. ¿Í»§¶Ë²éÕÒÔ¶³Ì¶ÔÏ󣬲¢µ÷ÓÃÔ¶³Ì·½·¨£¨HelloClient£©
5. Ö´ÐгÌÐò£ºÆô¶¯·þÎñHelloServer£»ÔËÐпͻ§¶ËHelloClient½øÐе÷ÓÃ
¾ßÌå´úÂë¼°¶ÔÓ¦²½ÖèÈçÏ£º
1. ´´½¨Ô¶³Ì½Ó¿Ú¼°ÉùÃ÷Ô¶³Ì·½·¨£¨HelloInterface.java£©
java ´úÂë
package com.unmi;

import java.rmi.*;

/**
* Ô¶³Ì½Ó¿Ú±ØÐëÀ©Õ¹½Ó¿Újava.rmi.Remote
*/
public interface HelloInterface extends Remote
{
/**
* Ô¶³Ì½Ó¿Ú·½·¨±ØÐëÅ׳ö java.rmi.RemoteException
*/
public String say() throws RemoteException;
}

2. ʵÏÖÔ¶³Ì½Ó¿Ú¼°Ô¶³Ì·½·¨£¨¼Ì³ÐUnicastRemoteObject£©Hello.java
java ´úÂë
package com.unmi;

import java.rmi.*;
import java.rmi.server.*;

/**
* À©Õ¹ÁËUnicastRemoteObjectÀ࣬²¢ÊµÏÖÔ¶³Ì½Ó¿Ú HelloInterface
*/
public class Hello extends UnicastRemoteObject implements HelloInterface
{
private String message;

/**
* ±ØÐ붨Òå¹¹Ôì·½·¨£¬¼´Ê¹ÊÇĬÈϹ¹Ôì·½·¨£¬Ò²±ØÐë°ÑËüÃ÷È·µØд³öÀ´£¬ÒòΪËü±ØÐëÅ׳ö³öRemoteExceptionÒì³£
*/
public Hello(String msg) throws RemoteException
{
message = msg;
}

/**
* Ô¶³Ì½Ó¿Ú·½·¨µÄʵÏÖ
*/
public String say() throws RemoteException
{
System.out.println(


Ïà¹ØÎĵµ£º

JAVAÖÐDWR¿ª·¢ÏîĿʵս¾­Ñé


×Ô¼ºÔÚ¹«Ë¾ÍøÕ¾¿ª·¢×ÜÓÃDWR¿ª·¢µÄÒ»¸ö¼òµ¥ÁÄÌì
±¾ÈËÒ²ÊÇÔÚÍøÕ¾¿ª·¢µØͼʱÓе½ÁËÕâ¸ö¼¼Êõ£¬¸ÕѧϰDWR°ë¸öÔÂ
¾Í°ÑËæÊÖдµÄÒ»¸ö¼òµ¥ÁÄÌìÀ´¸ø´ó¼Ò¹²Ïí£¬Çдèһϡ£
ÓÉÓÚ¿¼Âǵ½Ä³Ð©¾Ö²¿Ô­Òò£¬Ö»·¢±íÁËһЩÖØÒª¼¼Êõ·½ÃæµÄ×ÊÁÏ£¬Ã»ÓаÑÈ«²¿¶«Î÷¹²Ïí¡£Çë¸öÈËÌåÁ¡£
ÓÉÓÚDWR2.0ÓиöBug £¬ÎÒÓõÄDWR1.0£¬µ«ÊÇ£¬Ëü±ØÐëÓÃJDK1.4
......

Javaµ÷ÓÃÅú´¦Àí»ò¿ÉÖ´ÐÐÎļþ

ÓÃJava±àдӦÓÃʱ£¬ÓÐʱÐèÒªÔÚ³ÌÐòÖе÷ÓÃÁíÒ»¸öÏֳɵĿÉÖ´ÐгÌÐò»òϵͳÃüÁÕâʱ¿ÉÒÔͨ¹ý×éºÏʹÓÃJavaÌṩµÄRuntimeÀàºÍProcessÀàµÄ·½·¨ÊµÏÖ¡£ÏÂÃæÊÇÒ»ÖֱȽϵäÐ͵ijÌÐòģʽ£º 
... 
Process process = Runtime.getRuntime().exec(".\\p.exe"); 
process.waitfor( ); 
...&nb ......

Java´ò°üÏê½â

jarÎļþÌý˵¹ýÂð£¬Ã»ÓУ¿»òÕßÄ°Éú£¡ºÃ£¬Ã»¹Øϵ£¬Õâ¾ÍÊÇÎÒÃǵĵÚÒ»Õ¾£º´ò°ü·¢²¼¡£
Ϊʲô»áÓÐÕâ¸öÍæÒâÄØ£¬Ê×ÏÈ£¬ÕâÊÇjarµÄÈ«³Æ£ºJavaTM Archive (JAR) file£¬Êǵģ¬¾ÍÊÇjava´æµµÎļþ¡£ÕâÓеãÀàËÆzipÎļþ£¬ÏëÒ»ÏëËüÊǸÉʲôµÄÓõÄÄØ£¬Ñ¹Ëõ£¡£¿Ã»´í¾ÍÊÇҪѹËõ£¬½«ÎÒÃÇÔ­ÏÈÁãÉ¢µÄ¶«Î÷·Åµ½Ò»Ï£¬ÖØР×éÖ¯£¬ËùÓÐÕâЩĿµÄÖ»ÓÐÒ»¸ ......

Java²Ù×÷ExcelµÄ¹¤¾ßÀà

public class ExcelUtil {
/*
* ¸ù¾ÝExcelÎļþ·¾¶ºÍ±íµ¥Ãû³Æ£¬Ò»´Î²éÕÒ´Ë±íµ¥µÄËùÓмǼ*/
public static String[][] getContentByName(String sourcePath,String sheetName){
String[][] strArray = null;
try {

InputStream is = new FileInputStream(sourcePath);
Workbook wb = Workbook.get ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ