Menu

Security Manager Marked for Deprecation

2023-12-28
2023-12-30
  • David Debono

    David Debono - 2023-12-28

    Hey Flemming!

    I just tried installing Robocode tonight. I am on Java SE 21.0.1. I did as much debugging regarding Java's Security Manager as I could, but I'm getting an UnsupportedOperationException.

    Not sure what else I can do, but I would appreciate any help if you are able to offer it. I'm on MacOS Catalina 10.15.5.

    Thank you!

     
  • Flemming N. Larsen

    The java.security.manager property must be set to true which can be achieved by setting _JAVA_OPTIONS="-Djava.security.manager=allow" with the Java command when starting Robocode.

    With newer versions of Robocode, e.g. 1.9.5.2, you should not need to set this as this is set automatically when starting Robocode with the robocode.sh script, which calls the set_java_options.sh script, which again sets the above command.

    So if this is not working, I recommend you hardcode this in the robocode.sh file by replacing the java command section with this part:

    # Run Robocode
    java \
      -cp "libs/*" \
      -Djava.security.manager=allow \
      -Xmx512M \
      -Xdock:name=Robocode \
      -Xdock:icon=robocode.ico \
      -XX:+IgnoreUnrecognizedVMOptions \
      "--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED" \
      "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" \
      "--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED" \
      "--add-opens=java.desktop/sun.awt=ALL-UNNAMED" \
      robocode.Robocode "$@"
    

    I hope this helps?

     

Log in to post a comment.

MongoDB Logo MongoDB