Unleash the power of Java - JBang Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.
MIT License
Bot releases are visible (Hide)
This release adds jbanghub catalog in by default. Meaning jbang catalog list
now provides easy access to list of catalogs. See more at https://github.com/jbanghub.
JBang automatic java downloading now works on riscv64 and 32-bit arm systems thanks to @sxa.
We'd like to thank the following people for their contributions:
GitHub, Julien Ponge, Max Rydahl Andersen, Stewart X Addison, Tako Schotanus, allcontributors[bot]
Published by maxandersen 7 months ago
About time we have the first release of 2024!
This one has a good set of fixes and a few cleanup fixes around Aliases, Catalogs and app installs.
First, a (small) breaking change:
Aliases now get arguments appended instead of overwritten.
i.e. before you made an alias like:
jbang alias add
--name=color_sqlline \
--deps com.oracle.database.jdbc:ojdbc8:23.3.0.23.09,com.h2database:h2:2.0.204 \
sqlline:sqlline:1.12.0 --color=true
and call it jbang color_sqlline --nullValue='***'
the --color=true
would not apply.
That is now the case.
We should have done that from the beginning. It is more natural. Thank you to @robin-a-meade for reminding us!
Second, app installs now can specify build arguments to make it possible to have different commands with different build input.
For example specify system properties to change a version for a dependency.
Finally, catalogs now support import, i.e. jbang catalog add --import jbanghub
will import all the alias, catalogs, templates etc. in the jbanghub
catalog making it directly available without having to add @jbanghub
to the name.
To do this some of the list commands and how catalog names are treated have been unified so things looks the same and can be accessed consistently.
app install
(#1754)We'd like to thank the following people for their contributions:
GitHub, Matteo Mortari, Max Rydahl Andersen, Tako Schotanus, Tamas Cservenak, Tim Felgentreff, allcontributors[bot], renovate[bot]
Published by maxandersen 11 months ago
Moved artifact resolution to use MIMA via @cstamas's great work. This makes jbang
use the newer version of Maven's artifactresolver.
The first obvious benefit is that JBang now is able to utilize the performance improvements and use better http client implementations bringing about ~20% faster downloads.
When next version of Maven resolver becomes available that number should increase even more significantly when it starts utilising http2.
We've tested as much as we could - all existing tests passes but it is a change of dependency resolution thus if you have some project that changes behavior because of this behavior do please open an issue.
We'd like to thank the following people for their contributions:
GitHub, Max Rydahl Andersen, Tako Schotanus, Tamas Cservenak, allcontributors[bot]
Published by maxandersen 11 months ago
Added a magic %{deps:..}
expansion on command line that will resolve dependencies in that expression and replace it with a classpath.
Lets you do things like:
jbang sqlline@maxandersen -cp %{deps:org.hsqldb:hsqldb:RELEASE} other args
removing need to manually deal with absolute paths to .jar files.
%{deps:...}
substitutions in arguments (#1707)We'd like to thank the following people for their contributions:
GitHub, Max Rydahl Andersen, Tako Schotanus
Published by maxandersen 11 months ago
A few user contribute fixes (thanks @essobedo and @ritikverma2000) but otherwise a release to test and verify that dev.jbang:jbang-cli is now publish to maven central.
Full Changelog: https://github.com/jbangdev/jbang/compare/v0.111.0...v0.112.4
Published by maxandersen about 1 year ago
Lots of bugfixes and Groovy support now defaults to use Groovy 4. You can use //GROOVY <version>
to use older Groovy if you need to.
We'd like to thank the following people for their contributions:
Alex Karezin, Andrew O, GitHub, Libing Chen, Max Rydahl Andersen, P. Ottlinger, Tako Schotanus, allcontributors[bot]
Published by maxandersen about 1 year ago
We'd like to thank the following people for their contributions:
GitHub, Max Rydahl Andersen, Tako Schotanus
Published by maxandersen about 1 year ago
JBang will now use "central" rather than "mavencentral" as its id for fetching dependencies allowing for better sharing of downloads between Maven and JBang based builds. Also means you can do //REPOS central
as a shorthand. Should not break users but is a behavior change thus released as minor rather than a patch.
Fixed a regression where maven artifacts with capital letters failed to download.
Published by maxandersen over 1 year ago
Fixes and a minor and major new feature.
//DEPS aloca.jar
or //DEPS myscript.java
or even //DEPS https://my.site/some/script.java
is now allowed.
Allowing you to use scripts (or jars) as dependencies is different from using //SOURCES
in the sense that the //DEPS
gets built in isolation and is a true dependency rather than built inside the project. Allows for more decoupled and interesting composability of your jbang scripts and applications. Mainly; allow you to build and publish a java library without an intermediate publishing step.
Use it responsibly :)
I (re)learned from @danberindei that IDE's can work as clients to allow the java app to connect to the debugger rather than the other way around. Quite useful.
Thus jbang now allows customizing how debug is configured.
You can still just do jbang --debug myapp.java
but you can now also pass in a comma separated list to configure the JDPA connection string. i.e.jbang --debug=server=n myapp.java
to have it be a client rather than a server. You can set any other JDPA flag this way.
Docker publish had been failing the last few releases. Finally figured out the issue. Should now work. Crossing fingers.
Multi-user access were causing issues for caching in docker containers; that should be fixed too now.
We'd like to thank the following people for their contributions:
GitHub, Max Rydahl Andersen, Tako Schotanus
Published by maxandersen over 1 year ago
Recently support for main methods without a surrounding class was merged into OpenJDK main line.
This release now supports that feature.
At time of writing the default Termurin JDK builds does not have the latest build thus
for now you will have to manually build the JDK and set that up in your path.
Also since it is a Java preview feature you will need to use --enable-preview
or put //PREVIEW
in the file.
That means the smallest self-contained Java 21 example looks as follows:
//PREVIEW
//JAVA 21+
void main() {
System.out.println("Hello World");
}
And can now be run using jbang main.java
if you have Java 21 latest nightly build installed.
If you prefer
We'd like to thank the following people for their contributions:
GitHub, Max Rydahl Andersen
Published by maxandersen over 1 year ago
Let's call this the "Java 21" release as it adds jbang --enable-preview
option that allows you to do easily try out openjdk preview features like Java 21 String templates without having to deal with -souce 21
and individual flags for javac
nor java
.
The following will download Java 21 (early builds) if needed and evaluate the String template using the args
variable:
jbang --java 21 --enable-preview -c 'print(STR."First arg is \{args[0]}!")' JBang
Note: At time of release Adoptium the default Java provider used by JBang does not have early Java 21 builds thus either install a Java 21 manually or set JBANG_JDK_VENDOR=openjdk
in the environment to tell JBang to use openjdk
builds.
We'd like to thank the following people for their contributions:
GitHub, Max Rydahl Andersen, Tako Schotanus
Published by maxandersen over 1 year ago
Fix issue where ChatGPT errors on bad keys or usage limits.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen over 1 year ago
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen over 1 year ago
This enables use of GPT with JBang.
To use it you need an OPENAI_API_KEY and use the --preview
flag.
export OPENAI_API_KEY=sk-xxxxxxx-x-xxxxxx
jbang init gh.java "connect to github an fetch all repositories under jbangdev and collect how many stars they have"
And JBang will call out using ChatGPT's API to initialize and create a jbang script that attempts to do what you expressed on the command line.
You can see it in action in this video: https://www.youtube.com/watch?v=4Ol3sMm8xDM
Enjoy!
We'd like to thank the following people for their contributions:
Max Rydahl Andersen, GitHub, Fred Bricon
Published by maxandersen over 1 year ago
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen over 1 year ago
jbang edit
jbang edit yourfile.java
now assumes your IDE has one of the jbang plugins installed (see https://jbang.dev/ide).
Since jbang edit
install and run vscodium by default if you simply use jbang edit
things will just work.
If you want the old behavior (which is great with emacs, vi, etc.) then just enable sandbox using (-b
) jbang edit -b yourfile.java
JBang will based on the arguments you pass take an educated guess on which folder you want to open based on the source file.
It will look at package/directory names, for common editor markers (.vscode,.project,.idea, etc) and build files (pom.xml, build.gradle,etc) to find the best place to open an IDE.
In previous versions we introduced support for building modular applications. You indicate to JBang with a //MODULE
command or by having a module-info.java
file then JBang will automatically switch to using modulepaths over classpath. This release continues to clean things up and make it easier to use.
jbang export jlink
is now an option. Allowing you write a jbang app/script and export it as an application that has the Java runtime embedded within it.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen over 1 year ago
@quintesse been on fire and added some long-time coming improvements! Java 17, module support and magic file replacement.
JBang will now default to install Java 17 if no other Java is available. Mainly done since Java 13+ has features that makes symbolic
links work by default better on Windows; but also just that Java 17 is a better default to use for Java code these days. Note: JBang will continue to work with Java 8+ to ensure JBang is available on as many platforms as possible.
You can now add a //MODULE
line to your java sources and JBang will build and run it as a Java Module. Any //DEPS
gets converted to a requires
module and the module path rather than classpath is used for dependencies.
Try it out and tell if it works for your Java Module usecases.
JBang will now download remote files on the command line and replace them with file references. i.e. '%https://some.url/a.txt' or '%{https://some.url/a.txt}'.
This allows you utilize jbang's file download/caching mechanism to enhance scripts that deal with local files to handle remote urls:
jbang wordcount %https://github.com/dwyl/english-words/raw/master/words.txt
Similarly we've added this support to --javaagent
too allowing you do things like:
jbang --verbose --javaagent=byteman@maxandersen=boot:$(jbang info classpath byteman@maxandersen),script:%{https://raw.githubusercontent.com/bytemanproject/byteman/main/sample/scripts/FileMonitor.btm} env@jbangdev
Which fetches the byteman agent using the alias byteman@maxandersen
and fetches remotely the FileMonitor.btm
file to inject its instructions.
Enabling to use and run agents without having to install any java or agent scripts - all without having to change byteman.
jdk list --available
now takes into account os/arch (#1573)info tools
now downloads JDKs again (#1571)We'd like to thank the following people for their contributions:
Claus Ibsen, Tako Schotanus, Max Rydahl Andersen, GitHub, allcontributors[bot]
Published by maxandersen over 1 year ago
Small fixes - see below for details.
Project
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen
Published by maxandersen over 1 year ago
Fixed regression where if you swapped from new jbang to older jbang things could go bad due to the new caching.
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen
Published by maxandersen over 1 year ago
A new release and this one is a silent but beautiful one.
First there is a bunch of small fixes after last release custom JDK support introduced some regressions - like breaking Groovy support; but that is now back. Thanks for all the feedback!
jbang export fatjar
now exists. It merges all dependencies into a single combined jar allowing you to easily copy/distribute as a single command . It merges overlapping META-INF/services
and for most things that seem sufficient.
If you use it and things does not work, open issues and we can look at improving it.
@kanha-gupta contributed his first fix making it so --native
for building native images
works for aliases.
--fresh
Since forever jbang aliases were defined in a catalog and if that catalog was updated
AFTER you fetched something the first time you would not get the latest updates unless you used --fresh
.
Now @quintesse implemented proper cache eviction so that
a) when you run an alias jbang newcommand@somecatalog
and that newcommand
is not found locally then
jbang will now force reload the catalog to see if there is a new command.
b) By default every 12 hours the cache will be refreshed, meaning updates to alias catalogs (not just new ones will automatically be downloaded)
This allows for much smoother updates and ensuring users have the latest and greatest.
If for some reason you as a user do NOT want that (i.e. you really want zero updates) you have multiple options dependent on your usecase:
cache-evict
to never, i.e. jbang config set cache-evict never
--offline
then jbang
will not do any remote requests, including cache updates.jbang cmd@myorg//2.0
or jbang kill@quarkusio//5b58242
to lock in a specific alias.config list --show-available
now shows descriptionsexport fatjar
jdk install --force
was not forcing installhellojar.jar
with Java 8app setup
now tells user about --force
(#1550)We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, kanha gupta, GitHub