B4J Tutorial WSL Linux and B4x

If anyone is interested in being able to rapidly test desktop, console or server code in a headless environment using WSL, Linux and X11 I have prepared 19 ready to run distro's that can be downloaded here:

https://gitlab.com/x.distro/x.distro/tags


If you already have any distro's installed either uninstall them ( the ones provided are portable and can be installed on any drive where the ones downloaded from windows store are not) or if you wish rename the portable ones to something else and install side by side so say you have Ubuntu already downloaded and installed from windows store just rename the Ubuntu.exe in the zip file to Ubuntu-Portable.exe and install they will now run side by side.

install VcXsrv Portable from:

http://www.scrc.umanitoba.ca/doc/tutorial/T19_3a_xmingputty.htm


Install WSL if you have not already

from powershell run in administrator mode

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install Linux Distro by unzipping and running {distro}.exe

run distro and install java and javafx per package management instructions

run Export DISPLAY=xxx.xxx.xxx.xxx:0.0

(replace xxx.xxx.xxx.xxx with ip address of WSL instance)

then run java -jar {name}.jar

and GUI app will appear on localhost.

You can also run console and server apps in WSL Linux distro's

to uninstall a distro but not delete it run from cmd console or powershell

.\{distro}.exe clean

it will delete the rootfs reinstalling is as simple as running executable again and it will install a fresh rootfs so you will need to install any packages you need to test your apps again.

.\{distro}.exe help

to show all available commands or operations that can be applied to that distro.



this in my opinion is perfect dev setup just unzip on any drive and run the executable and it will install the distro. If u rename the executable you can install multiple copies of the same distro and as many Linux distro's side by side so you can test against Linux without having to install a VM or rent a server in the cloud our even firing up another computer.

I am still in the progress of making a automated build system to create these distro's so the source repo is a moving target and will not currently reproduce the downloads being provided I pulled those together from manual testing I did to even see if I could get multiple distros running.

FYI: there are a few of the distro's that WSL failed to setup nameservers so if the distro your using fails to connect to the internet install nano or vim and edit /etc/resolv.conf

WARNING: DO NOT EDIT THIS FILE OR ANY LINUX FILE WITH A WINDOWS EDITOR IT CAN DAMAGE ROOTFS
 
Last edited:
Top