I am trying to deploy a jar file on a tomcat server and initialise RMI. For this I am using the following command--
java -jar -Djava.security.policy=[rmi.policy file path] server.jar [server_ip] [port]
Now, I want the above initialisation and RMI Policy file, and port (for RMI) to be directly done by Java code within the same Jar file.
How do I do this? Also, can I use a URL instead of the IP address?
java.security.policy is a system property, and can be set with System.setProperty(). You don't need to set command line arguments from within the code, as you are just talking to yourself: just use those values in the appropriate places.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.