B4J Question Start of a new project. Questions about B4J

vecino

Well-Known Member
Licensed User
Longtime User
Hey, everybody, I need some advice.

I have been working with B4A since 2012 and I am very happy with the result, and from that date until now the improvements are continuous and the change is spectacular.

Now I have been asked for a new project and I am a little scared, it must work in Android, in gnu/Linux and mainly in Raspbian (the Raspberry system).
I've read that B4J can do it, but I have some doubts:

- Is it really true that B4J creates executables for all those systems?
- Does the same code work on all systems or do you have to compile it for each one?
- Is the source code the same for all or do you have to take into account something to compile for all?
- Is there a tutorial that explains everything you have to take into account to work with B4J to create executables that work in all systems I have indicated?

I don't know if it's possible or if I'm asking for something impossible.
I'm waiting for your advice.
Thank you very much.
Greetings.
 

sorex

Expert
Licensed User
Longtime User
there's a difference between Android and desktop environments.

a desktop environment (B4J) project should run on windows, ios, linus without much issues I guess. (only did some windows & raspbian coding so far)

with XUI you can create things that will work on both (Android/Windows) but you still need to use B4A & B4J to create the end product.

most code can be shared with classes tho so you don't need to do it multiple times from scratch.

you can add platform specific exeptions via conditional compiling (search for #if)
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thank you for your explanation.
So I think I understand that by using "#if" I can compile the same code with B4A and with B4J, is that right?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
no, it's the opposite.

you tell for which platform that piece of code is.

if you put code in a #if B4J block you will see that it will turn grey when you open the file in B4A/B4i so it's not valid for that platform and it won't be added during compilation.


actually when re-reading your line it's correct if you use #if B4A and B4J but if your focus is both platform it's no use to use it like that.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Ummm... I'm not sure I understood, in short, what I understood I was supposed to do:

Can I write a single code that can be compiled with B4A and B4J, indistinctly?
Do I have to write "repeated/adapted" code, for B4A and code for B4J?

What I need is to make a project that works in Gnu/Linux, Raspbian and Android, what do you advise me?
Greetings.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
¡Hola vecino!

Check these tutorials from the great @Peter Simpson if you haven't done yet.

And this one from Erel (great too... of course) :-D
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Probably these links will be usefull too:

 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Friends, thank you very much.
With all those links, I already have reading for the weekend :D
I hope to get something out of all that information.
 
Upvote 0

lucas555

Member
Licensed User
Longtime User
If you want to see B4J in real time , log on to pos3.ddns.net:9090 and see the real B4J miracle, just select your language and click on the OK button
this is a full apps created in B4J it is already install on 150 establishment and 750 Android cash register in CANADA and USA
It is a full back office for Store management it communicate with the android pos station and the signage raspberry application (again done in B4J) thru remote connector from Erel
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Wow, that's what I need, can you tell me something about the project? How is it done? What has been used in each system? Which remote connector do you mean?
Thank you.
 
Upvote 0
Top