B4J Question How can i know the commandline needed to start an B4J app

DonManfred

Expert
Licensed User
Longtime User
I have a UI App which is internally using the Discord Java Api to communicate with Discord (the app is a Bot for Discord).

When i try to build an Package with the internal packager i get an error.

So my idea was to be able to start the app by a batchfile.
If i start the app from the IDE everything is working fine. I do start the app in Releasemode.

Can i determine the commandline i need to use to start the app manually (not from within the IDE)? Is there a switch in the ini to output the commandline call?
 

DonManfred

Expert
Licensed User
Longtime User
Do you need it for yourself (= you know the path to Java 11/14) ?
yes.
But the packager always fails. Don´t know as of now if the @release_java_modules.txt is created successfully.

In the meantime i tried a command from an old batch i found on my HDD

I am able to start the app with
C:\Java\jdk-11.0.1\bin\javaw.exe --module-path C:\Java\jdk-11.0.1\javafx\lib --add-modules ALL-MODULE-PATH -jar orcbotui.jar

This solution should be fine for me ;-)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
for example when using JavaObject
Ohh, ok. I need to check.
I remember using JavaObject to redirect the LOG-Output to a file... At least. So it may fail.

BUT: The app is running actually started from the command above.
B4X:
Sub RedirectOutputToScreen (Dir As String, FileName As String)
    #if RELEASE
    Dim out As OutputStream = File.OpenOutput(Dir, FileName, False) 'Set to True to append the logs
    Dim ps As JavaObject
    ps.InitializeNewInstance("java.io.PrintStream", Array(out, True, "utf8"))
    Dim fd As JavaObject
    fd.InitializeStatic("java.io.FileDescriptor")
    Dim jout As JavaObject
    jout.InitializeNewInstance("java.io.FileOutputStream", Array(fd.GetField("out")))
    ps.InitializeNewInstance("java.io.PrintStream", Array(jout, True, "utf8"))

    Dim jo As JavaObject
    jo.InitializeStatic("java.lang.System")
    jo.RunMethod("setOut", Array(ps))
    jo.RunMethod("setErr", Array(ps))
    #end if
End Sub

Is active in the app and it is working.

But i´ll keep an eye on this ;-)

The release_java_modules file is available inside the installation folder.
AHHH. Ok, i´ll try to use the suggested link again this evenig ;-)
 
Upvote 0
Top