Open tylerhasman opened 5 years ago
So I managed to get it to work by launching the jar from my computer with an absolute path as so:
"StartGameCommand": "C:/Assets/jre/bin/java.exe -jar C:/Users/user/Documents/GitHub/WizardGame/out/artifacts/gameserver_jar/gameserver.jar",
Then I ran into another road block. There is a bug with the Java SDK for the game server. You need to initialize the "Build Metadata" in "JsonFileConfiguration", otherwise it throws a NPE. I detected it in the game server by loading in the config file, checking if its null, then setting it to an initialized value and resaving the file to the disc.
JsonFileConfiguration jsonFileConfiguration = new JsonFileConfiguration();
if(jsonFileConfiguration.getBuildMetadata() == null){
logger.warn("Detected build metadata is null!");
jsonFileConfiguration.setBuildMetadata(new HashMap<>());
jsonFileConfiguration.save();
logger.warn("Saved new json stuff");
}
@tylerhasman , thanks for reporting these issues. We will take a look and fix them and report back here.
@tylerhasman , I can see how the arguments were not converted properly when running outside of the container, but did you see the same issue while running it within a container as well?
Regarding the JsonFileConfiguration, were you trying to access the buildMetadata (when it was null) or are you suggesting that the serialization itself fails if the buildMetadata is null? I don't get the "Save" part above, did you update the file directly?
Yes I had to overwrite the file with valid data
hi @tylerhasman, any further questions/help needed towards this issue? If not, we can close it.
I don't believe the issue has actually been fixed. I had to use essentially java reflection to fix it.
thanks for mentioning that, will keep the issue open. Can you share your workaround so other users can potentially benefit while we're working on the fix?
My server is written in Java and I want to launch it like so:
"StartGameCommand": "C:/Assets/jre/bin/java.exe -jar C:/Assets/gameserver.jar",
However, the second
C:/Assets/
does not get replaced by the proper folder and as such, does not launch the jar file.