Bashj programming guide

De Lillois Fractale Wiki
Révision datée du 17 juin 2018 à 09:05 par Pge (discussion | contributions) (Page créée avec « == Understanding the architectire of bashj == This is a complement to the general bashj presentation page. The key idea behind bashj is the eexcution of a bashj server.... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigation Aller à la recherche

Understanding the architectire of bashj

This is a complement to the general bashj presentation page.

The key idea behind bashj is the eexcution of a bashj server. It is JVM perfromin essentially two tasks

translating bashj code into bash code

execute any java method call for any running bashj client

The benefit of this is the extreme efficiency of this minimal architecture.

But the developper of a bashs script should be aware of the fact that any global component of the JVM (static variables, Threads,...) will be shared with all other bashj clients launched.

For instance if a client 

Using bashj as a pure java 'interpreter'

It is possible to create a bashj page without nay bash line. In this case, the interpreter will automatically call and execute the method  static void main(String... a) , as in this example:

#!/usr/bin/bashj
#@java
static void main(String... a)
{u.p("Hello world, welcome to bashj");}

This minimal but complete code will excute normally.