当前位置: 技术问答>java相关
初学者:JB5的RMI例子出错,错在哪里?
来源: 互联网 发布时间:2015-04-12
本文导语: 我编译没有毛病,执行时出错,我钢开始学JAVA。 D:JBUILDER5JDK1.3binjavaw -classpath "D:jbuilder5samplesRMIclasses;D:JBUILDER5JDK1.3demojfcJava2DJava2Demo.jar;D:JBUILDER5JDK1.3jrelibi18n.jar;D:JBUILDER5JDK1.3jrelibjaws.jar;D:JBUILDER5JDK1.3jrelibrt.jar;D:JBUILDER5JD...
我编译没有毛病,执行时出错,我钢开始学JAVA。
D:JBUILDER5JDK1.3binjavaw -classpath "D:jbuilder5samplesRMIclasses;D:JBUILDER5JDK1.3demojfcJava2DJava2Demo.jar;D:JBUILDER5JDK1.3jrelibi18n.jar;D:JBUILDER5JDK1.3jrelibjaws.jar;D:JBUILDER5JDK1.3jrelibrt.jar;D:JBUILDER5JDK1.3jrelibsunrsasign.jar;D:JBUILDER5JDK1.3libdt.jar;D:JBUILDER5JDK1.3libtools.jar" -Djava.rmi.server.codebase=file:/opt/jbuilder4/samples/RMI/classes/ -Djava.security.policy=file:/opt/jbuilder4/samples/RMI/SimpleRMI.policy com.borland.samples.rmi.SimpleRMIServer
Exception occurred: java.rmi.RemoteException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
D:JBUILDER5JDK1.3binjavaw -classpath "D:jbuilder5samplesRMIclasses;D:JBUILDER5JDK1.3demojfcJava2DJava2Demo.jar;D:JBUILDER5JDK1.3jrelibi18n.jar;D:JBUILDER5JDK1.3jrelibjaws.jar;D:JBUILDER5JDK1.3jrelibrt.jar;D:JBUILDER5JDK1.3jrelibsunrsasign.jar;D:JBUILDER5JDK1.3libdt.jar;D:JBUILDER5JDK1.3libtools.jar" -Djava.rmi.server.codebase=file:/opt/jbuilder4/samples/RMI/classes/ -Djava.security.policy=file:/opt/jbuilder4/samples/RMI/SimpleRMI.policy com.borland.samples.rmi.SimpleRMIServer
Exception occurred: java.rmi.RemoteException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
|
修改你的policy文件
|
-Djava.security.policy=file:/opt/jbuilder4/samples/RMI/SimpleRMI.policy 这个参数指出了你的policy文件位置,在/opt/jbuilder4/samples/RMI/SimpleRMI.policy,既然是jb给例子,应该不会错,估计是这个路径本身就是错的。
|
在菜单的RUN的属性里设置Djava.rmi.server.codebase和Djava.security.policy,这两个参数是JVM所必须的。
|
应该是Project Properties里面Run底下VM parameters吧