B4J Question Writing code in b4j and then integrating it with projects coded in pure java - reg.

beelze69

Active Member
Licensed User
Longtime User
Hi,

I am a newbie to b4j.

I have been tasked with providing a 'java solution' for a project.

Since I do not know java, I am thinking of writing the code in b4j and then giving them the output.

My doubt:

i) What files do I have to give the 'java team' after I code the solution in b4j ?

ii) Whether just giving them the .jar file created would be sufficient (which they can execute with java -jar myprogram.jar)

Requesting for help

Thanks
 

beelze69

Active Member
Licensed User
Longtime User
Not really enough information to be definitive but B4J produces entire applications. It sounds like you want to write a module for incorporation into a larger Java project. B4J is not really suitable for this.
Hi,

Okay.. then why it is called B4J (or Basic for Java) ?

I thought it is for programmers like me who do not know java to be able to write applications that will generate Java code..

Kindly correct me.

Thank you..
 
Upvote 0

Heuristx

Active Member
Licensed User
Longtime User
It is called Basic for Java because you can write programs with it and run them on systems that can run Java.

But B4J does a lot more than just "translate" the Basic syntax to Java syntax. If it just translated the Java "language", then the structure of the programs would be just as complicated and clumsy as that of a Java program. In other words, it would translate the "sentences", but not the "paragraph" or the "chapter" of the program text.

B4X has its own ways of doing things that simplify structural things and it can produce code that is a lot simpler, more flexible and even faster than that written in Java.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I thought it is for programmers like me who do not know java to be able to write applications that will generate Java code..
No. B4J is a RAD environment intended to produce finished applications. While it does generate Java code that is then compiled by a Java compiler it is Java code that is structured to conform to the expectations and architectures of the B4J libraries that implement the GUI and other facilities. For instance it makes wide use of static classes which handwritten Java would usually not. B4J is not intended as a Java code generator - its aim is to allow programmers to easily produce finished applications without needing to use lower level languages like C#, C++ or Java. It just happens to use Java as an intermediate step - its predecessor, Basic4ppc, used C# and similarly was not intended to produce C# module for wider reuse.
 
Upvote 0

beelze69

Active Member
Licensed User
Longtime User
No. B4J is a RAD environment intended to produce finished applications. While it does generate Java code that is then compiled by a Java compiler it is Java code that is structured to conform to the expectations and architectures of the B4J libraries that implement the GUI and other facilities. For instance it makes wide use of static classes which handwritten Java would usually not. B4J is not intended as a Java code generator - its aim is to allow programmers to easily produce finished applications without needing to use lower level languages like C#, C++ or Java. It just happens to use Java as an intermediate step - its predecessor, Basic4ppc, used C# and similarly was not intended to produce C# module for wider reuse.
Hi Agraham,

Thanks for the detailed information.

As I understand, I can only compiled to standalone .exes and deploy them in the server.. Also since I work on Windows environment, I would need to compile the source code in 'b4j installed on Linux' before deploying them in our 'Linux Production environment'..

Kindly correct me if I am wrong.

Some more queries,

If one has to develop b4J Web Applications under Windows Environment, then how does one deploy them under i) Windows ii) Non-Windows environments (say Linux) ? ...

Thanks.
 
Upvote 0

beelze69

Active Member
Licensed User
Longtime User
It is called Basic for Java because you can write programs with it and run them on systems that can run Java.

But B4J does a lot more than just "translate" the Basic syntax to Java syntax. If it just translated the Java "language", then the structure of the programs would be just as complicated and clumsy as that of a Java program. In other words, it would translate the "sentences", but not the "paragraph" or the "chapter" of the program text.

B4X has its own ways of doing things that simplify structural things and it can produce code that is a lot simpler, more flexible and even faster than that written in Java.
Hi Heuristx,

Thank you for the information.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I can only compiled to standalone .exes and deploy them in the server..
No you can write both server and desktop GUI and non-GUI applications that run on both Linux and Windows. This is the main reason for choosing Java and JavaFX as they are platform independent. However I have no Linux experience so try searching the forum.
If one has to develop b4J Web Applications under Windows Environment, then how does one deploy them under i) Windows ii) Non-Windows environments (say Linux) ?
As I said, no idea as I'm Windows only , but people here are doing it so hopefully one of them will chip in.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
As I understand, I can only compiled to standalone .exes and deploy them in the server.. Also since I work on Windows environment, I would need to compile the source code in 'b4j installed on Linux' before deploying them in our 'Linux Production environment'..
UI apps -
If you are using Java 8 then the compiled jar will work on Linux, Windows and theoretically Mac (practically running on Mac is more complicated).
Better to use Java 11 and create a package: https://www.b4x.com/android/forum/t...lest-way-to-distribute-ui-apps.99835/#content
Using the external packager, you can create a package for Linux.

Non-UI / server - compiled jar will work on all platforms, Java version is not important (Mac still requires notarization).
You can also build a package for non-ui apps but it is mostly not needed.
 
Upvote 0

beelze69

Active Member
Licensed User
Longtime User
UI apps -
If you are using Java 8 then the compiled jar will work on Linux, Windows and theoretically Mac (practically running on Mac is more complicated).
Better to use Java 11 and create a package: https://www.b4x.com/android/forum/t...lest-way-to-distribute-ui-apps.99835/#content
Using the external packager, you can create a package for Linux.

Non-UI / server - compiled jar will work on all platforms, Java version is not important (Mac still requires notarization).
You can also build a package for non-ui apps but it is mostly not needed.
Thank You, Erel...
 
Upvote 0
Top