I want execute a .jar file, but it returns an error and no output at all

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rayayw

So, I get this error
E 0:00:06:0399 Condition ' ret == 0 ' is true. returned: ERR_CANT_FORK <C Source> platform/windows/os_windows.cpp:2509 @ execute() <Stack Trace> Control.gd:5 @ _on_Button_pressed()
when I try to execute this line
OS.execute("java", ['-jar', OS.execute("cd", ['C:/Users\aluno'], false)], false)
Any clues?

:bust_in_silhouette: Reply From: Calinou

If you want to start a command from a specific working directory, you may have to spawn a shell like this:

OS.execute("cmd.exe", ["/C", "cd C:\\Users\\aluno && java -jar some-file.jar"], false)

(Remember that literal backslashes in strings should be escaped in GDScript.)

This is OS-specific, so you’ll have to implement the command for each operating system you wish to support.