Git Product home page Git Product logo

Comments (15)

BenjaminAmos avatar BenjaminAmos commented on June 1, 2024 1
java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
       at java.base/java.lang.System.setSecurityManager(System.java:425)
       at org.destinationsol.modules.ModuleManager.loadEnvironment(ModuleManager.java:281)
       at org.destinationsol.modules.ModuleManager.init(ModuleManager.java:248)
       at org.destinationsol.SolApplication.create(SolApplication.java:158)
       at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:416)
       at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:366)
       at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
       at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:167)
       at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:138)

This error is likely the cause. It's a known issue and usually happens with Java versions above 17. The exception is thrown because SecurityManager is deprecated for removal. Since the game typically runs with Java 11 this is not usually encountered.

A workaround is something along the lines of the following in ModuleManager, which I will try and add soon:

if (Runtime.version().feature() < 18 || "allow".equals(System.getProperty("java.security.manager"))) {
    Policy.setPolicy(new ModuleSecurityPolicy());
    System.setSecurityManager(new ModuleSecurityManager());
} else {
    logger.warn("SecurityManager is disabled starting with Java 18 - module sandbox functionality is limited!");
    logger.warn("To enable SecurityManager, use the \"-Djava.security.manager=allow\" JVM option.");
}

Although with that nix-shell environment you should be using Java 11 already. What output do you see from running the java -version command in that shell?

from destinationsol.

BenjaminAmos avatar BenjaminAmos commented on June 1, 2024 1

The changes in BenjaminAmos@fdeced3 should work. We are unable to use the Runtime class yet because the code is still compiled against Java 8 for Android runtime compatibility. This means that we are limited to the APIs available in Java 8, even if the game is unable to actually run on Java 8 anymore.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024
$ ./gradlew run
Configuration on demand is an incubating feature.
Module modules:core has a build file so counting it complete and including it
> Task :build-logic:extractPluginRequests UP-TO-DATE
> Task :build-logic:generatePluginAdapters UP-TO-DATE
> Task :build-logic:compileJava UP-TO-DATE
> Task :build-logic:compileGroovy NO-SOURCE
> Task :build-logic:compileGroovyPlugins UP-TO-DATE
> Task :build-logic:pluginDescriptors UP-TO-DATE
> Task :build-logic:processResources UP-TO-DATE
> Task :build-logic:classes UP-TO-DATE
> Task :build-logic:jar UP-TO-DATE
> Task :engine:compileJava UP-TO-DATE
> Task :desktop:compileJava UP-TO-DATE
> Task :desktop:processResources UP-TO-DATE
> Task :desktop:classes UP-TO-DATE
> Task :engine:processResources UP-TO-DATE
> Task :engine:classes UP-TO-DATE
> Task :engine:jar UP-TO-DATE

> Task :desktop:run
 INFO [main] (ModulePathScanner.java:110) - Discovered module: core-2.1.0
java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
        at java.base/java.lang.System.setSecurityManager(System.java:425)
        at org.destinationsol.modules.ModuleManager.loadEnvironment(ModuleManager.java:281)
        at org.destinationsol.modules.ModuleManager.init(ModuleManager.java:248)
        at org.destinationsol.SolApplication.create(SolApplication.java:158)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:416)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:366)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:167)
        at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:138)
ERROR [main] (SolApplication.java:160) - Cannot initialize modules
ERROR [main] (SolDesktop.java:179) - This exception was not caught:
java.lang.NullPointerException: Cannot invoke "org.terasology.gestalt.module.ModuleEnvironment.getSubtypesOf(java.lang.Class, java.util.function.Predicate)" because "environment" is null
        at org.terasology.gestalt.entitysystem.component.management.ComponentTypeIndex.changeEnvironment(ComponentTypeIndex.java:84)
        at org.terasology.gestalt.entitysystem.component.management.ComponentTypeIndex.<init>(ComponentTypeIndex.java:67)
        at org.destinationsol.assets.AssetHelper.init(AssetHelper.java:82)
        at org.destinationsol.SolApplication.create(SolApplication.java:164)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.initializeListener(Lwjgl3Window.java:416)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:366)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:167)
        at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:138)

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 17s
13 actionable tasks: 1 executed, 12 up-to-date

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

Although with that nix-shell environment you should be using Java 11 already. What output do you see from running the java -version command in that shell?

Ah, I forgot to mention that I installed OpenJDK 19 instead, that's what I were running at that time.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024
if (Runtime.version().feature() < 18 || "allow".equals(System.getProperty("java.security.manager"))) {
    Policy.setPolicy(new ModuleSecurityPolicy());
    System.setSecurityManager(new ModuleSecurityManager());
} else {
    logger.warn("SecurityManager is disabled starting with Java 18 - module sandbox functionality is limited!");
    logger.warn("To enable SecurityManager, use the \"-Djava.security.manager=allow\" JVM option.");
}
DestinationSol/engine/src/main/java/org/destinationsol/modules/ModuleManager.java:284: error: cannot find symbol
        if (Runtime.version().feature() < 18 || "allow".equals(System.getProperty("java.security.manager"))) {
                   ^
  symbol:   method version()
  location: class Runtime
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
6 warnings

Where do you place it?

from destinationsol.

BenjaminAmos avatar BenjaminAmos commented on June 1, 2024

Did you find a solution for this? I had meant to get back to this but temporarily forgot for a time.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

Did you find a solution for this? I had meant to get back to this but temporarily forgot for a time.

I tried pasting snippet code at ModuleManager.java:284. It failed to build.

I know that DS is supposed to be run in jdk11, but I wanted to test whether it runs faster in newer versions.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

Thank you. fdeced3 didn't work on Java 21, but worked on Java 17.

from destinationsol.

BenjaminAmos avatar BenjaminAmos commented on June 1, 2024

Is it showing the same error as before on Java 21? I tested a distribution build under Java 21 and it appeared to work.

Running ./gradlew run might be more problematic though since the version of Gradle we currently use doesn't support Java 21 (it supports Java 19 at most). Upgrading Gradle is not currently planned since I need to co-ordinate it with also upgrading the Android gradle plugin at the same time, which would necessitate a move to Java 17.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

Is it showing the same error as before on Java 21? I tested a distribution build under Java 21 and it appeared to work.

No, only happens on Java 21.

[info] Java Home: /nix/store/4v41d9wyc4n4idvcx5fa7vpbnqp14ccz-temurin-bin-21.0.1
[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xms128m,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant
[info] Gradle User Home: /home/user/.gradle
[info] Gradle Version: 7.6
[info] Module modules:core has a build file so counting it complete and including it
Module modules:pirates has a build file so counting it complete and including it
> Task :build-logic:extractPluginRequests UP-TO-DATE
> Task :build-logic:generatePluginAdapters UP-TO-DATE
> Task :build-logic:compileJava UP-TO-DATE
> Task :build-logic:compileGroovy NO-SOURCE
> Task :build-logic:compileGroovyPlugins FAILED
[error] FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':build-logic:compileGroovyPlugins'.
> BUG! exception in phase 'semantic analysis' in source unit 'precompiled_DestinationSolIde' Unsupported class file major version 65

from destinationsol.

BenjaminAmos avatar BenjaminAmos commented on June 1, 2024

If you change the gradle version used:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

to

https\://services.gradle.org/distributions/gradle-8.4-all.zip

Does it help at all?

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

Hi. I have this problem now, it's making it difficult to keep developing.
redhat-developer/vscode-java#3449 (comment)
Please help.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

If you change the gradle version used:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

to

https\://services.gradle.org/distributions/gradle-8.4-all.zip

Does it help at all?

Yes, it seems so. I don't see the "Error: Gradle Build Failed" message again.

from destinationsol.

BenjaminAmos avatar BenjaminAmos commented on June 1, 2024

Hi. I have this problem now, it's making it difficult to keep developing. redhat-developer/vscode-java#3449 (comment) Please help.

I tend to use IntelliJ Idea personally, so the most I know is that your issue looks a bit like microsoft/vscode-gradle#1431 and it might be worth disabling the Gradle for Java extension. You might have to get used to running ./gradlew run whenever you want to test the game otherwise.

from destinationsol.

jozefcifre avatar jozefcifre commented on June 1, 2024

I tend to use IntelliJ Idea personally, so the most I know is that your issue looks a bit like microsoft/vscode-gradle#1431 and it might be worth disabling the Gradle for Java extension. You might have to get used to running ./gradlew run whenever you want to test the game otherwise.

It worked! Thank you!

from destinationsol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.