Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can i place the .policy file in rmi technology??  RSS feed

 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now , i'm learning rmi, have some question.
1. If i don't want to set the policy path in command line, put it into a file instead. how can i do ?
2. What meaning "-Djava.rmi.server.codebase" is?
3. The content of policy file:
permission java.net.SocketPermission
permission java.io.FilePermission
......
witch is necessary, and what's thear's mean?
thanks a lot!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12143
255
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo
Please change your displayed name to meet the JavaRanch naming policy. You may change it here.
You do not need to have a policy file or set a codebase to complete the assignment. I assume you are doing the old assignment. In the new assignments, you would have been warned that:
  • You must not require the use of an HTTP server.
  • You must not require the installation of a security manager.
  • You must provide all classes pre-installed so that no dynamic class downloading occurs.


  • Perhaps you should look at starting the RMI Registry from within your server application? Take a look at the java.rmi.registry.LocateRegistry class to see how you can do that. If you do this you should not need to set the codebase or grant permissions.
    The codebase is used for dynamic code downloading. You can find out more about this in the Sun Tutorial Dynamic code downloading using RMI (Using the java.rmi.server.codebase Property). (Yes, that is the title).
    The following tutorials will help explain how to use RMI (and how to set the parameters if you really want to do that).
    Fundamentals of RMI Short Course
    Sun RMI tutorial.
    The Trail: Security in Java 2 SDK 1.2 gives an overview of security and setting permissions in the policy files.
    You may specify the codebase and the policy file on the command line. The example given in the Sun RMI tutorial is:
    Of course, any parameter that you can define on the command line can also be set programattically. Take a look at System.setProperty() for that.
    Regards, Andrew
     
    Mark Spritzler
    ranger
    Sheriff
    Posts: 17309
    11
    IntelliJ IDE Mac Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Andrew for that great response.
    I think that Leo is just asking an RMI question in general and is not currently working on the SCJD assignment.
    Which means I am going to move this to the appropriate forum. Distributed Java Forum.
    Mark
    [ July 07, 2003: Message edited by: Mark Spritzler ]
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!