Alessandro71 Well-Known Member Licensed User Longtime User Jun 6, 2025 #1 follow this steps: 1) open B4J (version 10.20 with JDK jdk-19.0.2 as downloaded from the B4J page) 2) File/New.../Console (Non-UI) a new project will appear with just these lines B4X: Copy 'Non-UI application (console / server application) #Region Project Attributes #CommandLineArgs: #MergeLibraries: True #End Region Sub Process_Globals End Sub Sub AppStart (Args() As String) Log("Hello world!!!") End Sub 3) Project/Build Standalone Package 4) open a command prompt and run the executable from the build directory Bash: Copy Microsoft Windows [Versione 10.0.26100.4202] (c) Microsoft Corporation. Tutti i diritti riservati. C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build>testconsole.exe C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build>Hello world!!! the "Hello world" line is printed after the prompt, as the command was executed in background (in unix-like "&" way) I would expect the following output: Bash: Copy C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build>testconsole.exe Hello world!!! C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build> is there any way to fix this?
follow this steps: 1) open B4J (version 10.20 with JDK jdk-19.0.2 as downloaded from the B4J page) 2) File/New.../Console (Non-UI) a new project will appear with just these lines B4X: Copy 'Non-UI application (console / server application) #Region Project Attributes #CommandLineArgs: #MergeLibraries: True #End Region Sub Process_Globals End Sub Sub AppStart (Args() As String) Log("Hello world!!!") End Sub 3) Project/Build Standalone Package 4) open a command prompt and run the executable from the build directory Bash: Copy Microsoft Windows [Versione 10.0.26100.4202] (c) Microsoft Corporation. Tutti i diritti riservati. C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build>testconsole.exe C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build>Hello world!!! the "Hello world" line is printed after the prompt, as the command was executed in background (in unix-like "&" way) I would expect the following output: Bash: Copy C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build>testconsole.exe Hello world!!! C:\Users\aless\Documents\B4A\testconsole\Objects\temp\build> is there any way to fix this?
aeric Expert Licensed User Longtime User Jun 6, 2025 #2 Execute the run_debug.bat file. Alternatively, you can modify the file as following : Code: Copy echo off cd bin java.exe @release_java_modules.txt -m b4j/b4j.example.main cd .. and save as "run_debug_echo_off.bat" Bash: Copy C:\B4X\Development\helloconsole\Objects\temp\build>run_debug_echo_off.bat C:\B4X\Development\helloconsole\Objects\temp\build>echo off Hello world!!! C:\B4X\Development\helloconsole\Objects\temp\build> Edit: Exit the B4J app using ExitApplication2(0) B4X: Copy Sub AppStart (Args() As String) Log("Hello world!!!") ExitApplication2(0) End Sub Last edited: Jun 6, 2025 Upvote 0
Execute the run_debug.bat file. Alternatively, you can modify the file as following : Code: Copy echo off cd bin java.exe @release_java_modules.txt -m b4j/b4j.example.main cd .. and save as "run_debug_echo_off.bat" Bash: Copy C:\B4X\Development\helloconsole\Objects\temp\build>run_debug_echo_off.bat C:\B4X\Development\helloconsole\Objects\temp\build>echo off Hello world!!! C:\B4X\Development\helloconsole\Objects\temp\build> Edit: Exit the B4J app using ExitApplication2(0) B4X: Copy Sub AppStart (Args() As String) Log("Hello world!!!") ExitApplication2(0) End Sub