The last task to do named RUSH JAVA, it ask to implement a RMI server.
I was ill so I didn't do it. But it seems cool so I try to find some sample about RMI and run a server in local. My reference file is here : RMI simple tutoriel(in Chinese).
But When I launch the project in Intellij, there is an error like this:
/home/tearsyu/idea-IC-145.597.3/jdk1.8.0_77/bin/java........In according to tutoriel, we shoul add a policy file which declare the permission at runtime, BUT I DIDN'T FIND WHERE SHOULD TO ADD POLICY FILE IN INTELLIJ.
java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1234" "listen,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
I do add the cmd line "-Djava.security.policy=java.policy Server" to tell the IDE how compiler it, but:
Error: Could not find or load main class ServerPS:-Djava.security.policy tells program where the security policy file is, and java.policy is in root dir of project. Content:
Process finished with exit code 1
grant{ permission java.security.AllPermission;};I did't find solution for this error, it seems come from an error entry command from IDE.
BUT I FIND AN OTHER SOLUTION TO RUN IT.
JUST USING COMMAND LINE AT TERMINAL.
Rush/src$javac *.java -d ../out/
Rush/src$java -Djava.security.policy=java.policy -classpath ../out/ Server
Second Terminel:java -classpath ../out/ Client
No comments:
Post a Comment