B4J Question Help with batch file?

MrKim

Well-Known Member
Licensed User
Longtime User
Per Erel's comment HERE.
I have done as instructed. I have put the server config file, server jar, and batch file in the

MyApp\B4J\Objects\temp\build\bin
directory with the following batch file (or some variation of this:
B4X:
START /MIN javaw.exe -jar SKDBServer.jar
The problem is this always runs MyApp instead of starting SKDBServer.jar.
I have played with variations of this for hours, putting the files in \build for example and then using
B4X:
START /MIN \bin\javaw.exe -jar SKDBServer.jar

Whatever I do, if the batch file works at all, it opens MyApp.

If I use the installed version of java with the following

B4X:
START /MIN C:\Java\jdk-11.0.1\bin\javaw.exe -jar SKDBServer.jar
It works fine. Even if I put the files in the bin directory above.
It only seems to be a problem when I try to use the javaw.exe the was created by Build Standalone Package:

MyApp\B4J\Objects\temp\build\bin\javaw.exe


Thanks in advance for any help.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The correct way to embed a non-ui program in a package is with these instructions (other post is wrong):
- Change the package name of the non-ui app: b4j.nonui for example.
- Run it in release mode.
- Create a UI app and refer to the other jar with:
B4X:
#AdditionalJar: path to other jar
Build a package.

Edit run-debug.bat and change the b4j.example.main with b4j.nonui.main

However I tested it and it doesn't work with server projects with WebSockets. The jetty library is a complex library and it will require more work to make it run as a module.

You can take the full openjdk, without the fmods, and distribute it with your app.
 
Upvote 0
Top