Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(distribution): re-enable SecurityManager in distributions running under Java 18 and above #5091

Merged

Conversation

BenjaminAmos
Copy link
Contributor

Contains

When running under Java 18/19, the game crashes on start-up when attempting to set a SecurityManager. SecurityManager was deprecated in Java 17 and is disabled by-default from Java 18.

This fixes #5090 by re-enabling SecurityManager in the launch scripts. The changes should only affect users running Java 18 and later.

How to test

  • Build a distribution using gradlew distZip.
  • Obtain a Java 19 runtime
    (I tested this with the one from https://adoptium.net)
  • Temporaily set the JAVA_HOME environment variable to point at the Java 19 distribution.
  • Run ./Terasology (or Terasology.bat) from the built distribution folder.
  • The game should reach the main menu.

Notes

  • I'm not certain that parsing the java version number in batch/sh files is going to be reliable but it seems to work. There is at least one JEP which suggests that the output format may be intentional. The parsing logic won't work with Java 8 but that's not supported for Terasology anymore, as far as I know.
  • This will get you to the main menu but not much further (see Java 17 compatibility #3976 (comment) for other issues).

Copy link
Member

@Cervator Cervator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm this tests out (on Win10 with Java 19)!

Not merging just yet although this is fine - this is the first PR I am ready to merge in what feels like ages and I want to make sure I'm up to date with the process :-)

Nicely done!

@Cervator Cervator added Category: Build/CI Requests, Issues and Changes targeting gradle, groovy, Jenkins, etc. Category: Security Requests, Issues and Changes targeting security labels Apr 3, 2023
@Cervator Cervator merged commit a2cdbd5 into MovingBlocks:develop Apr 6, 2023
@BenjaminAmos BenjaminAmos deleted the java-19-security-manager branch April 7, 2023 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Build/CI Requests, Issues and Changes targeting gradle, groovy, Jenkins, etc. Category: Security Requests, Issues and Changes targeting security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when starting the game with Java 19 (versions 18 and above all affected)
2 participants