呵呵,推荐你一个小软件Active ports,可以看到根多的端口占用。比netstat -an看到更多
老外写的软件,主页好像是www.ntutility.com
老兄搞的很深入啊,自己编译stub,佩服,学习
老外写的软件,主页好像是www.ntutility.com
老兄搞的很深入啊,自己编译stub,佩服,学习
解决方案 »
- 问一个java基础问题
- Socket送信的outputstream.write()的问题
- ssh引包冲突问题.大牛们,帮我看看可以么?
- hibernate one2many映射
- 大型网站的安全性问题
- 一个关于Spring中使用SQL的问题,有难度!
- 一个关于COOKIE的问题.请会的帮忙解答.
- 一个jdom的bug!!!!,以前提过,现在再贴。
- 关于客户端程序直接访问WEBSPHERE的JNDI服务的问题 100分!!!!
- weblogic7建不了连接池,怎么办?
- new org.apache.struts.action.ActionMessage(key,value)中的value有什么用?
- 代友发贴:寻高手做一电子商务类网站(Java架构)
远程接口:HelloWorld.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface HelloWorld extends Remote
{
public String sayHelloWorld() throws RemoteException;
}
远程对像:HelloWorldImpl.java
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class HelloWorldImpl extends UnicastRemoteObject implements HelloWorld
{
public HelloWorldImpl() throws RemoteException
{
super();
}
public String sayHelloWorld() throws RemoteException
{
return "Hello World";
}
}
服务端:Server.java
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import javax.naming.InitialContext;
public class Server
{ public static void main(String[] args)
{
try
{
LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
HelloWorldImpl server=new HelloWorldImpl();
new InitialContext().bind ("rmi://localhost/sayHelloWorld",server);
System.out.println("Server Started");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
客户端:Client.java
import javax.naming.InitialContext;
public class Client
{
public static void main(String[] args)
{
try
{
HelloWorld client=(HelloWorld)new InitialContext().lookup("rmi://localhost/sayHelloWorld");
System.out.println(client.sayHelloWorld());
}
catch(Exception e)
{
e.printStackTrace();
} }
}
把所有的文件保存在同一个目录下,然后
1、javac *.java
2、rmic HelloWorldImpl
3、java Server
4、java Client
2004-12-17 18:44 <DIR> ..
2004-12-17 18:39 524 Server.java
2004-12-17 18:39 181 HelloWorld.java
2004-12-17 18:39 340 HelloWorldImpl.java
2004-12-17 18:40 490 Client.java
2004-12-17 18:46 703 Client.class
2004-12-17 18:46 224 HelloWorld.class
2004-12-17 18:46 403 HelloWorldImpl.class
2004-12-17 18:46 797 Server.class
2004-12-17 18:49 0 rmic
9 个文件 3,662 字节
2 个目录 9,804,546,048 可用字节F:\x\x>rmic HelloWorldImpl
error: Class HelloWorldImpl not found.
1 error
rmic -v1.2 -d . HelloWorldImpl
还是不行的话,给他打个包(常规的做法)