How to remove jbang again? Or at least get a clean slate to be able to start over?
I had run the initial Quick Start sequence, i.e.
curl -Ls https://sh.jbang.dev | bash -s - app setup
jbang init --template=cli hello.java
Doing so I got a warning message that I was still using v0.7.0 and that there was a newer version 0.129 (or similar) available. That reminded me that I had once downloaded and installed JBang (about 2 years ago) and apparently that old version was still somewhere on my path and interfering with this new setup. So I cleaned my path variable and removed everything "JBangish" that I could find (i.e. the old location where I had installed it as well as the $HOME/.jbang folder that had just been newly created by the above command) with the intention to subsequently start over from a clean slate.
But when I now do another curl -Ls https://sh.jbang.dev | bash -s - app setup again I get an error "[jbang] JBang environment is already set up.". But it is NOT anymore set up since I have manually removed things.
So, where and what is hiding here that falsely signals to the setup that JBang is still installed? And how do I remove those residuals so that I can properly start over?
BTW: this is on Windows 10 but with misc. unix-tools (curl, bash, ...) installed, that's why the above command worked as-is.
That warning about setup is probably somewhere in zshrc or bashrc there is trace of the jbang setup?
Nope - I found no such file (I assume it would be in my home directory, right?):
mmo:/mnt/c/Users/mmo$ ls bashrc
ls: cannot access 'bashrc': No such file or directory
mmo:/mnt/c/Users/mmo$ ls .bashrc
ls: cannot access '.bashrc': No such file or directory
mmo:/mnt/c/Users/mmo$ ls zshrc
ls: cannot access 'zshrc': No such file or directory
mmo:/mnt/c/Users/mmo$ ls .zshrc
ls: cannot access '.zshrc': No such file or directory
mmo:/mnt/c/Users/mmo$
But I just learned that the bash command is obviously automatically executed in my WSL Ubuntu environment (apparently thanks to some MS utility "bashlauncher" of whose existence I had no idea ||-( ). And in WSL the $PATH indeed still contains
mmo:/mnt/c/Users/mmo$ echo $PATH
/home/mmo/.jbang/bin:/home/mmo/.jbang/currentjdk/bin:/usr/local/sbin:...
So - I guess - the setup simply checks whether the path contains a ".jbang"-entry. Now I only need to find out, where the WSL's path is configured...
For anyone banging (pun intended...) into the same issue:
One can conveniently access the WSL filesystem by going to \\wsl.localhost. There you see your installed distro and can navigate to the user's home directory, in my case \\wsl.localhost\Ubuntu\home\mmo. Here I found a .bashrc file and at it's end I found:
...
# Add JBang to environment
alias j!=jbang
export PATH="$HOME/.jbang/bin:$HOME/.jbang/currentjdk/bin:$PATH"
export JAVA_HOME=$HOME/.jbang/currentjdk
So, that's where JBang had entered itself preventing a clean re-install. Remove these lines and your path is free for a clean re-install. If on Windows then just be aware that using that method JBang installs itself in your system's WSL, not on the Windows "host" as I had originally expected.
@mmoser18 , I also have WSL2 (Ubuntu) installed on Win11.
Both my Win11 environment and WSL2 environment have their own locally installed copies of JBang.
On Win11, I used UniGetUI (https://github.com/marticliment/UniGetUI/releases/download/3.3.1/UniGetUI.Installer.exe) to install
- MS Java 21
java -version openjdk version "21.0.8" 2025-07-15 LTS OpenJDK Runtime Environment Microsoft-11933218 (build 21.0.8+9-LTS) OpenJDK 64-Bit Server VM Microsoft-11933218 (build 21.0.8+9-LTS, mixed mode, sharing)
- Jbang 0.129.0
jbang version 0.129.0
UniGetUI will periodically check for updates to the software packages that it manages, and will alert you to updates for JBang or Java, etc.
On WSL2 (Ubuntu) I used SDKMAN! to install both Java and JBang using .sdkmanrc file
# Java
java=21.0.8-tem
# JBang
jbang=0.129.0
and command:
$ sdk env install
@wfouche Just out of curiosity: where did you install the Windows-copy of JBang? In your %HOME%\.jbang or elsewhere? For now I simply copied \\wsl.localhost\Ubuntu\home\mmo\.jbang to C:\Users\mmo\.jbang (leaving out the jdks-subdirectory and instead defining an env-var JBANG_DEFAULT_JAVA_VERSION pointing to %JAVA_HOME%) and added C:\Users\mmo\.jbang\bin to my path. It works fine but I am not so convinced whether this is a good approach. Specifically I doubt that UniGetUI (which I am also using to remain up-to-date) will pick it up there.
@mmoser18 , I forgot to mention that I installed Scoop on Windows as well - https://scoop.sh/
JBang then installs via UniGetUI using scoop into C:\Users\werne\scoop\apps\jbang\0.129.0\bin
But you can also use command C:\> scoop install jbang to install JBang on Windows (if scoop is already installed).