Android Tutorial [Linux] [B4X] Wine Installer

📦 Install B4A+B4J on Linux Mint using Wine with a single silent script​


GitHub: https://github.com/pyhoon/b4x-wine-installer


Files:
  1. install_b4x_wine.sh
  2. uninstall_b4x_wine.sh
  3. configure_b4x_settings.sh
  4. README.md
Archived:
  1. install_b4a_wine.sh
  2. install_b4j_wine.sh
  3. uninstall_b4a_wine.sh
  4. uninstall_b4j_wine.sh
  5. configure_b4a_settings.sh
  6. configure_b4j_settings.sh
  7. repair_b4a_launcher.sh
  8. repair_b4j_launcher.sh
The script is modified from the combination of B4A Wine Installer and B4J Wine Installer script generated by AI (Qwen3.6-Plus chat)
Using a single wine prefix saved you 3GB+ of diskspace.

Disclaimer: I haven't really fully tested it. Use it at your own risk.

🚀 How to use​

Just 3 lines of commands (You can copy and paste in one go).
Bash:
wget https://raw.githubusercontent.com/pyhoon/b4x-wine-installer/main/install_b4x_wine.sh
chmod +x install_b4x_wine.sh
./install_b4x_wine.sh

⚠️ Note / Reminder​

  1. When you double-click on a launcher (desktop icon), Linux Mint will prompt you to choose "Launch Anyway" or "Mark Executable". Choose the latter so it won't ask you again.
  2. Remember to comment the #CustomBuildAction: folders ready for RoboCopy.exe or Shared Files
  3. Even if you have run "configure_b4x_settings.sh", B4A still pops up asking you to set the Paths, just click "Ok" to save the settings.
  4. Make sure you have deleted old scripts and you are not downloaded the new script which renamed to .sh1 extension. Otherwise you are not executing the new script.
  5. Tips: To run winetricks, run winetricks prefix=.wine_b4x

🤝 Contributing​

Found an issue or have an improvement?
  1. Fork the repository
  2. Create a feature branch
  3. Submit a Pull Request

🙏 Credits​

Special thanks to B4X members who have contributed tutorial/guides in the past so that AI could use them as references to assist me to generate this script.
@Mihai Rainer Jr. @walt61 @Raboebie

📄 License​

MIT License - See LICENSE file for details.
 

Attachments

  • Screenshot3.png
    Screenshot3.png
    87.8 KB · Views: 553
  • Screenshot4.png
    Screenshot4.png
    94.7 KB · Views: 313
Last edited:

walt61

Well-Known Member
Licensed User
Longtime User
WOW, brilliant, very smooth! I ran it again in a Linux Mint 22.3 Cinnamon 64-bit VM in VirtualBox and everything seems to work fine.

One hiccup: files configure_b4a_settings.sh, configure_b4j_settings.sh, and uninstall_b4x_wine.sh weren't downloaded by the script (and it does refer to them at the end - and they're very useful).

A couple of suggestions:
- if the script would ask the user which environment(s) to install (B4A, B4J, or B4X), it would become a 'one size fits all' and you'd only need to maintain one script if changes were needed
- somehow let the user decide which paths to use for java, Android SDK, additional libraries, projects; perhaps just mention that to do this, the relevant variables' values can be changed at the top of the script before running it (in that case, all of these folders must have corresponding variables)
 

aeric

Expert
Licensed User
Longtime User
One hiccup: files configure_b4a_settings.sh, configure_b4j_settings.sh, and uninstall_b4x_wine.sh weren't downloaded by the script (and it does refer to them at the end - and they're very useful).
These are optional scripts. I have tested and all these files were downloaded successfully using the commands in the README.md.

A couple of suggestions:
The repo is open source. I welcome anyone to improve it or modify the script for their personal preferences.
 

aeric

Expert
Licensed User
Longtime User
A couple of suggestions:
- if the script would ask the user which environment(s) to install (B4A, B4J, or B4X), it would become a 'one size fits all' and you'd only need to maintain one script if changes were needed
- somehow let the user decide which paths to use for java, Android SDK, additional libraries, projects; perhaps just mention that to do this, the relevant variables' values can be changed at the top of the script before running it (in that case, all of these folders must have corresponding variables)
I don't fully understand what this paragraph means so I just throw it to Qwen to "read/think" for me.

The script is now refactored and updated with some improvement.
  1. ✅ Interactive/CLI product selection (B4A, B4J, or Both)
  2. ✅ Configurable paths via editable variables at the top (override-friendly)
 
Last edited:

aeric

Expert
Licensed User
Longtime User
A lot of bugs has been fixed and all scripts are now more interactive.
  • 1 script to install B4A, B4J or both.
  • 1 script to configure B4A, B4J or both.
  • 1 script to uninstall B4A, B4J, both or the entire prefix.
screenshot3-png.171747
 

aeric

Expert
Licensed User
Longtime User
Added a YouTube Video on first post. Stay tune for more videos.
 
Last edited:

Giu

Member
Licensed User
Longtime User
I sent a PR with compatibility for Arch and derviated distributions.
 

aeric

Expert
Licensed User
Longtime User
I sent a PR with compatibility for Arch and derviated distributions.
I will consider to put this script into a separate sub directory. I think this will be more maintainable and organized for future distros support.
 

aeric

Expert
Licensed User
Longtime User
Hi @Giu, I have tested your script inside VirtualBox.
B4J server app has no issue on Arch based distro.

The video is uncut for now. It is 22min long. I will trim it when I am free.
 

Jon_K

New Member
Licensed User
Hi! Thank YOU!!! it works, I had to fake it with Linux Mint zena, though. If you're trying this on the latest Mint try replacing this block:

get_ubuntu_codename() {
local codename
# Try lsb_release first, fallback to /etc/os-release
if command -v lsb_release &>/dev/null; then
codename=$(lsb_release -sc)
else
codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2)
fi

if [[ -z "$codename" ]]; then
log_error "Could not determine Ubuntu codename. Please set WINE_REPO_CODENAME manually."
fi

# Allow override via environment variable
if [[ -n "$WINE_REPO_CODENAME" ]]; then
echo "$WINE_REPO_CODENAME"
return
fi

# Officially supported by WineHQ (as of June 2026)
local known_codenames=("focal" "jammy" "noble" "plucky" "questing" "resolute")
local known=0
for k in "${known_codenames[@]}"; do
if [[ "$codename" == "$k" ]]; then
known=1
break
fi
done

if [[ $known -eq 0 ]]; then
# Print warnings to stderr (>&2) so they NEVER bleed into variable assignment
echo "Ubuntu codename '$codename' is not yet in the WineHQ repository list." >&2
echo "Falling back to 'noble' (Ubuntu 24.04 LTS) – this usually works for newer releases." >&2
codename="noble"
fi

# ONLY echo the clean codename string to stdout
echo "$codename"
}

I'm telling Mint it's not 'zena'. Anyhow, it fired off just fine, before I was getting this error:
Types: deb

URIs: https://dl.winehq.org/wine-builds/ubuntu/

---> Suites: [1;33m[!][0m Ubuntu codename 'zena' is not yet in the WineHQ repository list. <--

[1;33m[!][0m Falling back to 'noble' (Ubuntu 24.04 LTS) – this usually works for newer releases.

noble

Components: main

Signed-By: /usr/share/keyrings/winehq.gpg

delete /etc/apt/sources.list.d/winehq.sources, change the script and give it a go if it's erroring and you're running zena.

hope it helps. took about 2 hours for me to figure it out. Yikes! at least B4J is on my machine. I was getting kind of tired of Lazarus. It's a good IDE, no hate,
just isn't for me.
 

aeric

Expert
Licensed User
Longtime User
Hi! Thank YOU!!! it works, I had to fake it with Linux Mint zena, though. If you're trying this on the latest Mint try replacing this block:

get_ubuntu_codename() {
local codename
# Try lsb_release first, fallback to /etc/os-release
if command -v lsb_release &>/dev/null; then
codename=$(lsb_release -sc)
else
codename=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2)
fi

if [[ -z "$codename" ]]; then
log_error "Could not determine Ubuntu codename. Please set WINE_REPO_CODENAME manually."
fi

# Allow override via environment variable
if [[ -n "$WINE_REPO_CODENAME" ]]; then
echo "$WINE_REPO_CODENAME"
return
fi

# Officially supported by WineHQ (as of June 2026)
local known_codenames=("focal" "jammy" "noble" "plucky" "questing" "resolute")
local known=0
for k in "${known_codenames[@]}"; do
if [[ "$codename" == "$k" ]]; then
known=1
break
fi
done

if [[ $known -eq 0 ]]; then
# Print warnings to stderr (>&2) so they NEVER bleed into variable assignment
echo "Ubuntu codename '$codename' is not yet in the WineHQ repository list." >&2
echo "Falling back to 'noble' (Ubuntu 24.04 LTS) – this usually works for newer releases." >&2
codename="noble"
fi

# ONLY echo the clean codename string to stdout
echo "$codename"
}

I'm telling Mint it's not 'zena'. Anyhow, it fired off just fine, before I was getting this error:
Types: deb

URIs: https://dl.winehq.org/wine-builds/ubuntu/

---> Suites: [1;33m[!][0m Ubuntu codename 'zena' is not yet in the WineHQ repository list. <--

[1;33m[!][0m Falling back to 'noble' (Ubuntu 24.04 LTS) – this usually works for newer releases.

noble

Components: main

Signed-By: /usr/share/keyrings/winehq.gpg

delete /etc/apt/sources.list.d/winehq.sources, change the script and give it a go if it's erroring and you're running zena.

hope it helps. took about 2 hours for me to figure it out. Yikes! at least B4J is on my machine. I was getting kind of tired of Lazarus. It's a good IDE, no hate,
just isn't for me.
Ya, it should work on Zena without modification if I am not mistaken. I have YouTube video for the demo.
 
Top