B4J Question B4J jar to Linux

DarkoT

Active Member
Licensed User
I'm starting with B4J on Windows10 and I was really positive surprised how "smooth" is to create UI application. I created my first App and this works on all Windows 10 machines. In company we have about 20 Linux machines...

I try to distribute this app to Linux - and app will not start... Nothing happens on Linux, when I try to execute jar (with launcher; I gave the system all rules that Jar can be executed)…

I update everything, I was try to update/downgrade version of Java (everything from version 8 - to latest Java version - 15), I try with OpenJDK (version 11) – still will not working…



I read every detail in this forum; maybe I’m not smart enough to understand the logic…

Which version of Java should I use to compile app to Jar that this will work on Win10 and on Linux machines?! Which version should be installed on Linux and Windows, that this jar can be executed…



Sorry, this is really annoying, but – I’m without any Ideas what should I do, that this will work…

(this is more like my last scream before I raise my hands and reinstall every Linux comp to windows ☹) – or to switch to some web app …(and – yes – I’m coming from windows World, I beginner in Linux world and also – new in B4J) ☹



Thanks for help…

Darko
 

aeric

Expert
Licensed User
Longtime User
Are you using B4JPackager11 ?
 
Upvote 0

DarkoT

Active Member
Licensed User
Are you using B4JPackager11 ?
No, I'm not familiar with B4JPackager11. I was try to create, but this will create a EXE (for windows installation) or ?! ... Basically I just need to create simple JAR and copy it to another machine (windows, linux, ...)...

(If you can help me - you will get 200 coffee's) :)
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
No, I'm not familiar with B4JPackager11. I was try to create, but this will create a EXE (for windows installation) or ?! ... Basically I just need to create simple JAR and copy it to another machine (windows, linux, ...)...

(If you can help me - you will get 200 coffee's) :)
You need to use this tool in the IDE to create the json file. Of course it will also create the exe. You will then need to edit the path in json file and run using B4J Bridge in Linux.
 
Upvote 0

DarkoT

Active Member
Licensed User
You need to use this tool in the IDE to create the json file. Of course it will also create the exe. You will then need to edit the path in json file and run using B4J Bridge in Linux.
Ok, thanks... I will try... Which java should I use? Java 11? Or can I stay on Java 8?

In any case - I will give you echo with result...

Tnx... ;)
 
Upvote 0

DarkoT

Active Member
Licensed User
You need to use this tool in the IDE to create the json file. Of course it will also create the exe. You will then need to edit the path in json file and run using B4J Bridge in Linux.
Okay, no I have created EXE with a B4JPackager11 ... And now? What should I change (witch file) and what should I copy to Linux - all this stuff? And which Jar should i Start?

(sorry for bugs you with this; it's really annoying - from my point of view - to complicated...)

1614079750675.png
 
Upvote 0

DarkoT

Active Member
Licensed User
Okay, no I have created EXE with a B4JPackager11 ... And now? What should I change (witch file) and what should I copy to Linux - all this stuff? And which Jar should i Start?

(sorry for bugs you with this; it's really annoying - from my point of view - to complicated...)

View attachment 108609
And result is the same as before... I copy everything to Linux Machine, try to start jar.jar ... Nothing... Btw - on Windows can I normally run java -jar jar.jar and working... :(
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
And result is the same as before... I copy everything to Linux Machine, try to start jar.jar ... Nothing... Btw - on Windows can I normally run java -jar jar.jar and working... :(
Copy B4JBridge to Linux. B4J Bridge will help you download all the application files from Windows to Linux.
Download B4JBridge here:
 
Upvote 0

DarkoT

Active Member
Licensed User
Copy B4JBridge to Linux. B4J Bridge will help you download all the application files from Windows to Linux.
Download B4JBridge here:
Why B4J Bridge?! It's not possible just to copy generated jar to Linux and start it?! Maybe I really not understand the logic how to create just simple jar from B4J for Linux...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
In windows development machine, you already have all the required libraries but not in the target machine. The packager make it easy so you don’t need to install Java on the target machine. The jar needs some libraries/dependencies runtime files to run the UI application. Once you done for one machine, you can copy to another machine using USB disk or through terminal.
 
Last edited:
Upvote 0

DarkoT

Active Member
Licensed User
In windows development machine, you already have all the required libraries but not in the target machine. The packager make it easy so you don’t need to install Java on the target machine. The jar needs some libraries/dependencies to run the UI application. Once you done for one machine, you can copy to another machine using USB disk or through terminal.
OOO... I'm little bit closer to solution... I added B4j-bridge to one linux comp and successfully connected B4j over brigdge... But - stil not working... When i try to compile solution and sent over bridge to linux, receive a error:

B4JPackager11 Version 1.21
Exe name: c:\Work\Vtisk\B4JProjects\TestniTest\Objects\TestniTest.exe
InputJar: c:\Work\Vtisk\B4JProjects\TestniTest\Objects\TestniTest.jar
main$ResumableSub_PrepareFolders.resume (java line: 1200)
java.io.FileNotFoundException: c:\Work\Vtisk\B4JProjects\TestniTest\Objects\TestniTest.jar (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:218)
at anywheresoftware.b4a.objects.streams.File.Copy(File.java:336)
at b4j.example.main$ResumableSub_PrepareFolders.resume(main.java:1200)
at b4j.example.main._preparefolders(main.java:1049)
at b4j.example.main$ResumableSub_Start.resume(main.java:1520)
at b4j.example.main._start(main.java:1499)
at b4j.example.main._appstart(main.java:127)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43
)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.main(main.java:28)

- in picture:

1614094454450.png


any ideas? Additional help will be --> ufff... ;)
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
OOO... I'm little bit closer to solution... I added B4j-bridge to one linux comp and successfully connected B4j over brigdge... But - stil not working... When i try to compile solution and sent over bridge to linux, receive a error:



- in picture:

View attachment 108620

any ideas? Additional help will be --> ufff... ;)
I can't see the log. Can you copy and paste the text?

If you follow this tutorial, you will see that you need to modify the InputJar path.
B4X:
Private InputJar As String = "/users/username/Downloads/AngryBirds.jar"
or use the packager.json in Linux.
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
You may also need OpenJDK 11 + OpenJFX 11 (SDK + jmods)


Sorry, I can't remember clearly how I did this last year. Please post your error message if still not succeed.
 
Upvote 0

DarkoT

Active Member
Licensed User
You may also need OpenJDK 11 + OpenJFX 11 (SDK + jmods)


Sorry, I can't remember clearly how I did this last year. Please post your error message if still not succeed.
Aeric - you are my new best friend.... :) Now works... It's really complicated to solve all this combinations, but - now it's working. You helped me definitely and you deserve to get a coffee... ;) :p I'm sure, I'm not only one which is confused with all this linux-win-mobile-web combinations... Everything on end sounds logical, but is hard to find all solutions on one place... In any case - many thanks and 'm sure that other developers will be more as thanks-full for this help... ;)

@Erel (and others) has made a beautiful environment which can be very very useful for rapid development... I'm proud that can be a part of this community... And - I'm sure - this community will grow...

I will close this case...

Tnx, Darko
 
Upvote 0
Top