David W
03/19/2022, 7:20 PMrunDistributable
than when run from run
, from a Java CLI jar, or from a Kotlin CLI jar.
Here's the full code of the application (the rest is as generated from the CfD template)
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
Button(onClick = {
ProcessBuilder(
"C:\\Program Files (x86)\\Fractal Softworks\\Starsector1.95.1-RC6\\starsector.exe"
)
.directory(File("C:\\Program Files (x86)\\Fractal Softworks\\Starsector1.95.1-RC6"))
.start()
}) {
Text("Hello Madness")
}
}
}
The actual issue is hard to describe; starsector.exe
launches a java-based game that runs on its own jre 7/8. The game crashes only when launched from CfD dist because it's unable to resolve some relative file paths that are passed to it from `starsector.exe`as jvm params. Mimicking the functionality of the exe
with a custom java -jar
thing fixes the issue if I use absolute paths for the game files, but this has other side effects (like any windows compat settings applied to the exe
aren't used since I'm working around it.
I don't want to work around the problem; the code works everywhere except as a CfD dist. I can take that ProcessBuilder
code, put it into a pure java or kotlin CLI program, compile a jar, run it, and it'll run the game just fine. Literally it's only when run from runDistributable
(or from the .exe
built from createDistributable
).
Any ideas? What's being done differently by CfD's dist exe?Arsen
03/19/2022, 7:46 PMProcessBuilder("C:\\my-file.exe", "arg_one", "arg_two")
David W
03/19/2022, 8:08 PMDavid W
03/19/2022, 8:09 PMapp.exe
generated from buildDistributable
than when run from run
?David W
03/19/2022, 8:10 PMArsen
03/19/2022, 8:13 PMDavid W
03/19/2022, 8:13 PMDavid W
03/19/2022, 8:13 PMArsen
03/19/2022, 8:14 PMDavid W
03/19/2022, 8:14 PMArsen
03/19/2022, 8:14 PMDavid W
03/19/2022, 8:15 PMDavid W
03/19/2022, 8:15 PMDavid W
03/19/2022, 8:16 PMDavid W
03/19/2022, 8:16 PMArsen
03/19/2022, 8:37 PMDavid W
03/19/2022, 8:39 PMDavid W
03/19/2022, 8:39 PMArsen
03/19/2022, 8:42 PMArsen
03/19/2022, 8:43 PMDavid W
03/19/2022, 8:44 PMjava.exe -XX:CompilerThreadPriority=1 -XX:+CompilerThreadHintNoPreempt -Djava.library.path=native\\windows -Xms1536m -Xmx1536m -Xss2048k -classpath janino.jar;commons-compiler.jar;commons-compiler-jdk.jar;starfarer.api.jar;starfarer_obf.jar;jogg-0.0.7.jar;jorbis-0.0.15.jar;json.jar;lwjgl.jar;jinput.jar;log4j-1.2.9.jar;lwjgl_util.jar;fs.sound_obf.jar;fs.common_obf.jar;xstream-1.4.10.jar -Dcom.fs.starfarer.settings.paths.saves=..\\saves -Dcom.fs.starfarer.settings.paths.screenshots=..\\screenshots -Dcom.fs.starfarer.settings.paths.mods=..\\mods -Dcom.fs.starfarer.settings.paths.logs=. com.fs.starfarer.StarfarerLauncher
David W
03/19/2022, 8:45 PM.exe
launcherDavid W
03/19/2022, 8:45 PMDavid W
03/19/2022, 8:45 PMArsen
03/19/2022, 8:47 PMArsen
03/19/2022, 8:49 PMDavid W
03/19/2022, 8:51 PMDavid W
03/19/2022, 8:51 PMDavid W
03/19/2022, 8:52 PMArsen
03/19/2022, 8:57 PMDavid W
03/19/2022, 8:59 PMDavid W
03/19/2022, 9:16 PMDavid W
03/19/2022, 9:16 PMprintln("Program arguments: ${args.joinToString()}")
Path.of("./launcherlog.log")
.writeText(
buildString {
appendLine("args:" + args.joinToString())
appendLine("env:" + System.getenv().entries.joinToString { "${it.key}=${it.value}" })
})
David W
03/19/2022, 9:17 PMrun
and runDistributable
on the CfD side to see what was differentDavid W
03/19/2022, 9:17 PMDavid W
03/19/2022, 9:17 PMDavid W
03/19/2022, 9:18 PM.bat
-> game jar files
and not using the game's .exe
, but that doesn't work either, same error as always but works when not using runDistributable
David W
03/19/2022, 9:30 PMArsen
03/20/2022, 11:34 AMDavid W
03/20/2022, 7:54 PM.dll
that launches Starsector and we managed to call that native code from a Hello world CfD appDavid W
03/20/2022, 7:54 PMDavid W
03/20/2022, 7:54 PMDavid W
03/20/2022, 7:55 PMrunDistributable
-> native windows code that launches -> Starsector.exe
still failsDavid W
03/20/2022, 7:56 PMCommand::new(install_dir.join("starsector.exe"))
.current_dir(install_dir)
.spawn()
is his simple launch code, minus all of the other JNI insanityDavid W
03/20/2022, 7:57 PMDavid W
03/20/2022, 7:58 PMDavid W
03/20/2022, 7:59 PMrun
but not runDistributable
Arsen
03/21/2022, 8:19 AMDavid W
03/21/2022, 3:31 PMDavid W
03/21/2022, 3:31 PMDavid W
03/21/2022, 3:31 PMDavid W
03/21/2022, 3:31 PMDavid W
03/24/2022, 2:53 PMalexey.tsvetkov
03/30/2022, 11:43 AMDavid W
03/30/2022, 2:52 PMDavid W
03/30/2022, 2:52 PMDavid W
03/30/2022, 3:12 PMDavid W
03/30/2022, 3:38 PMDavid W
03/30/2022, 3:38 PMalexey.tsvetkov
03/30/2022, 4:34 PM-Dorg.lwjgl.util.Debug=true
to the `<INSTALL_DIR>/vmparams`;
3. Reproduce the issue;
4. Share the resulting starsector.log
?alexey.tsvetkov
03/30/2022, 4:43 PMstarsector-core\native\windows\OpenAL64.dll
, which seems to indicate, that the right version of OpenAL is loaded (also, I use a fresh install of Windows 10, so I doubt there would be a system-wide OpenAL).
The sound is working in both cases with my computer.
I’m really intrigued by the issue. No explanation so far, thoughDavid W
03/30/2022, 4:51 PMDavid W
03/30/2022, 4:51 PMDavid W
03/30/2022, 4:52 PMDavid W
03/30/2022, 4:53 PMDavid W
03/30/2022, 4:54 PMDavid W
03/30/2022, 5:01 PMalexey.tsvetkov
03/30/2022, 5:06 PMDavid W
03/30/2022, 5:07 PMDavid W
03/30/2022, 5:08 PMalexey.tsvetkov
03/30/2022, 5:08 PMwith environment variables not being passed onThat could be it, but I thought you’ve compared the env vars of a dummy launched process?
David W
03/30/2022, 5:09 PMDavid W
03/30/2022, 5:10 PMDavid W
03/30/2022, 5:11 PMalexey.tsvetkov
03/30/2022, 5:20 PMDavid W
03/30/2022, 5:21 PMalexey.tsvetkov
03/30/2022, 5:22 PMDavid W
03/30/2022, 5:28 PMDavid W
03/30/2022, 5:32 PMDavid W
03/30/2022, 6:04 PMDavid W
03/30/2022, 6:05 PMDavid W
03/30/2022, 6:20 PM[LWJGL] Initial mode: 1920 x 1080 x 32 @360Hz
[LWJGL] Found 92 displaymodes
[LWJGL] Removed 60 duplicate displaymodes
[LWJGL] MemoryUtil Accessor: AccessorUnsafe
[LWJGL] getPathFromClassLoader: searching for: OpenAL64
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: sun.misc.Launcher$AppClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.net.URLClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.security.SecureClassLoader.findLibrary(java.lang.String)
[LWJGL] getPathFromClassLoader: searching for: lwjgl
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: sun.misc.Launcher$AppClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.net.URLClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.security.SecureClassLoader.findLibrary(java.lang.String)
[LWJGL] Found 3 OpenAL paths
[LWJGL] Testing 'native\\windows\OpenAL64.dll'
[LWJGL] Failed to load native\\windows\OpenAL64.dll: Could not load OpenAL library (126)
[LWJGL] Testing 'C:\Program Files (x86)\Fractal Softworks\Starsector-do-not-touch\starsector-core\OpenAL64.dll'
[LWJGL] Failed to load C:\Program Files (x86)\Fractal Softworks\Starsector-do-not-touch\starsector-core\OpenAL64.dll: Could not load OpenAL library (126)
[LWJGL] Testing 'OpenAL64.dll'
[LWJGL] Failed to load OpenAL64.dll: Could not load OpenAL library (126)
[LWJGL] *** Alert *** Starsector 0.95.1a-RC6
Error in sound initialization, proceeding with sound disabled.
org.lwjgl.openal.AL10.nalDistanceModel(I)V
[LWJGL] *** Alert *** Starsector 0.95.1a-RC6
Fatal: org.lwjgl.openal.AL10.nalListenerfv(IJ)V
Check starsector.log for more info.
David W
03/30/2022, 6:22 PMDavid W
03/30/2022, 6:23 PMDavid W
03/30/2022, 6:26 PMrun
in IntelliJ (where the game runs as expected, no crash):
[LWJGL] Initial mode: 1920 x 1080 x 32 @360Hz
[LWJGL] Found 92 displaymodes
[LWJGL] Removed 60 duplicate displaymodes
[LWJGL] MemoryUtil Accessor: AccessorUnsafe
[LWJGL] getPathFromClassLoader: searching for: OpenAL64
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: sun.misc.Launcher$AppClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.net.URLClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.security.SecureClassLoader.findLibrary(java.lang.String)
[LWJGL] getPathFromClassLoader: searching for: lwjgl
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: sun.misc.Launcher$AppClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.net.URLClassLoader.findLibrary(java.lang.String)
[LWJGL] Failed to locate findLibrary method: java.lang.NoSuchMethodException: java.security.SecureClassLoader.findLibrary(java.lang.String)
[LWJGL] Found 3 OpenAL paths
[LWJGL] Testing 'native\\windows\OpenAL64.dll'
[LWJGL] Found OpenAL at 'native\\windows\OpenAL64.dll'
David W
04/01/2022, 4:20 PM