B4J Question Standalone Server + necessary JDK folders?

ilan

Expert
Licensed User
Longtime User
hi

so i finished my webapp using b4j and looks really cool. now i have 2 question.

currently i am starting the server with a script (start.bat)

B4X:
java\bin\java -jar server.jar

q1: java folder is in the same folder as server.jar and inside is bin + lib folder.
everything works fine but i dont like that a cmd window is opened when i run the server and stays open. i would like the server to run in background the same way when you run in the ide in release mode the server starts and you dont have any cmd windows. so what is the best way to do it? OS is currently WINDOWS 11 (may change in the future)

q2: what exactly are the necessary folders i need to include to the project so i can put it in any pc running windows without the need to install java jdk. so what i found out is bin + lib works but they are 200mb+ together. any way to make the necessary folder smaller and still run it as standalone server?

current folder structure:

1768901574464.png


thanks!
 

aeric

Expert
Licensed User
Longtime User
a1:
You don't need to put the jar in same folder of OpenJDK.

B4X:
start C:\Java\jdk-19.0.2\bin\javaw -jar C:\B4J\Apps\Server.jar
 
Last edited:
Upvote 1
Solution

Chris2

Active Member
Licensed User
Longtime User
q2: what exactly are the necessary folders i need to include to the project so i can put it in any pc running windows without the need to install java jdk.
Have you tried Build Standalaone Package?
Even if you don't want to use the package itself, I think that it includes only the files in the bin & lib folders that are needed for your app, so it might point you in the right direction.
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
a1:
You don't need to put the jar in same folder of OpenJDK.

B4X:
start C:\Java\jdk-19.0.2\bin\javaw -jar C:\B4J\Apps\Server.jar
thanks that did the trick although i trie using javaw but i still got the window maybe the start command did it because i did not use it before.


Have you tried Build Standalaone Package?
Even if you don't want to use the package itself, I think that it includes only the files in the bin & lib folders that are needed for your app, so it might point you in the right direction.
yes i tried but it didnot work and also i read that erel says standalone is not supported on [non ui] server apps
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
thanks that did the trick although i trie using javaw but i still got the window maybe the start command did it because i did not use it before.



yes i tried but it didnot work and also i read that erel says standalone is not supported on [non ui] server apps
Yes, the start command is important or else it won't work.

Build standalone package also work for non-UI server app.
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
Build standalone package also work for non-UI server app.
100%

You need a bunch of #PackagerProperty declarations though:
 
Upvote 0
Top