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 hidden (Show)
Published by maxandersen over 2 years ago
Bug fix + add lines(String) top-level method to read a file into lines.
-c
without code (#1247)We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub
Published by maxandersen over 2 years ago
Small changes this time with a big impact.
-i
for interactive without sourcesYou always could to jbang --interactive <your.java|jsh|jar|gav>
to have jbang
start up your application/script within the jshell interpreter. Which is great but what if you just wanted to try out some API's without having to bother making a file to get started?
Now you can - just use jbang --interactive
or jbang -i
for short and you have a jshell. Of course that in itself is not interesting, but when you combine it with --deps
it does become interesting. i.e. below is an example of starting jbang in interactive mode with access to h2 and jandex libraries.
jbang --deps com.h2database:h2:LATEST,org.jboss:jandex:2.4.2.Final -i
WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
| Welcome to JShell -- Version 17
| For an introduction type: /help intro
jshell> import org.jboss.jandex.*;
jshell> Index.of(org.h2.Driver.class);
$2 ==> org.jboss.jandex.Index@9f48198
-c
for code snippet executionjbang
now can execute java code directly allowing you to process standard input to make great one-liners like:
$ echo "hello world" | jbang -c 'lines().forEach(s->println(s.substring(6)))`
world
or this check for how many 5 letter words contains Man's best friend?
$ cat 5letterwords.txt | jbang -c 'lines().filter(s->s.contains("dog")).forEach(p->println(p))'
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
bedog
dogal
dogey
doges
doggy
doggo
dogie
dogly
dogma
dogra
undog
In the last example you will notice a few things:
-c
enables that the first argument is treated as code instead of a scriptSystem.in
println
top-level method is available to easily print.We got more ideas on adding some top-level methods to enable using java on
the command line.
And of course you can combine -c
with --interactive
and --deps
and even
-s myscripts.jsh
to load your own top-level methods.
Enjoy and Stay tuned :)
--code
option for running literal scripts (#1243)We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub
Published by maxandersen over 2 years ago
0.89 fixes long-standing issue in how jshell was setup with dependencies. Turns out that to have execution AND content-assist working you must specify the classpath twice. Quite bad UX when using 3rd party dependencies but now jbang have it fully working :)
Imagine you have a file named deps.jsh
that uses the Faker library:
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS https://github.com/blocoio/faker/tree/1.2.8
import io.bloco.faker.Faker;
Faker fake = new Faker("da-DK");
Then you can run it directly using ./deps.jsh
or jbang deps.jsh
but you can also use jbang --interactive deps.jsh
to have some fun with Faker.
https://user-images.githubusercontent.com/54129/153685297-b1eccf37-9585-4a6a-b529-e9194cb1734c.mp4
Compare that to what you would need to write out using raw jshell
:
jshell --execution=local -J--add-modules=ALL-SYSTEM --class-path=/Users/max/.m2/repository/com/github/blocoio/faker/1.2.8/faker-1.2.8.jar:/Users/max/.m2/repository/com/github/bmoliveira/snake-yaml/v1.18-android/snake-yaml-v1.18-android.jar:/Users/max/.m2/repository/joda-time/joda-time/2.9.1/joda-time-2.9.1.jar -J--class-path=/Users/max/.m2/repository/com/github/blocoio/faker/1.2.8/faker-1.2.8.jar:/Users/max/.m2/repository/com/github/bmoliveira/snake-yaml/v1.18-android/snake-yaml-v1.18-android.jar:/Users/max/.m2/repository/joda-time/joda-time/2.9.1/joda-time-2.9.1.jar --startup=DEFAULT --startup=/var/folders/yb/sytszfld4sg8vwr1h0w20jlw0000gn/T/jbang_arguments_12529495078878297375deps.jsh /Users/max/code/personal/jbangdev/jbang/itests/deps.jsh
Simplicity FTW :)
Also include fix (#1232) so jbang init
actually will honor default properties for a template.
Thanks to @nandorholozsnyak and @quintesse!
Full Changelog: https://github.com/jbangdev/jbang/compare/v0.88.0...v0.89.1
Published by maxandersen over 2 years ago
New JBang release with a bunch of quality of life improvements.
To simplify install/setup running in a environment where there is no terminal to ask for input, i.e. if using curl
for install
we now show a graphical dialog when needing to confirm trusted URLs or choosing an editor. This was not
an easy decision but it enables to have just one command install, like: curl -Ls https://sh.jbang.dev | bash -s - app install quarkus@quarkusio
Note: this will only show up if needed and AWT/Swing is available, if not the text based info is used instead.
When using jbang edit
by default we offered to install and run vscodium - now we also scan PATH for common IDE's like eclipse
, code,
idea` etc. Giving you a choice to use your already installed IDE more easily.
JBang uses foojay.io to download Java Development Kit's normally getting Adoptium major releases.
If you want to try out another distribution and even earlyaccess versions you can now tweak these using environment variables
You can set these in your environment or use them directly when calling jbang, i.e.:
JBANG_JDK_VENDOR=oracle JBANG_JDK_RELEASE=ea jbang --java 18 otp.java
This will get latest Java 18 early access release of Oracle JDK.
When using .jsh
(jshell
) //SOURCES
are now supported allowing you to include
other .jsh files.
@nandorholozsnyak in his first contribution enabled Catalogs to document its properties
and will be included in jbang catalog list
.
Below are the full list of changes and fixes:
edit
(#1211)//SOURCES
now work in .jsh files too (#1221)We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Carlos Freund, allcontributors[bot], NΓ‘ndor HolozsnyΓ‘k
Published by maxandersen over 2 years ago
Bunch of improvements to make things more informative and stable; especially around JDK installs and jbang app install ascript
will now verify ascript
is buildable.
app setup
on Windows (#1196)tagName
instead of projectVersion
(#1183)We'd like to thank the following people for their contributions:
Basil Crow, Prafull Kotecha, Michael Simons, Tako Schotanus, Ikko Ashimine, Max Rydahl Andersen
Full Changelog: https://github.com/jbangdev/jbang/compare/v0.86.0...v0.87.0
Published by maxandersen almost 3 years ago
Two years anniversary of JBang, so thought it would be good with a release :)
In this we have a few fixes to get better error information when dependencies cannot resolve and libs
gets renamed to lib
for consistency during export and a bug fix to jbang tools info
making Intellij IDEA JBang plugin work better.
The big news is that JBang now supports using multiple BOM's which is commonly used by frameworks like Quarkus, Spring, or any time you are trying to manage dependencies in larger projects. Give it a try and lets hear how it goes!
Happy New Year!
We'd like to thank the following people for their contributions:
Max Rydahl Andersen, GitHub, allcontributors[bot], NΓ‘ndor HolozsnyΓ‘k
Published by maxandersen almost 3 years ago
Small fixes for Kotlin.
We'd like to thank the following people for their contributions:
Libing Chen, Max Rydahl Andersen, GitHub
Published by maxandersen almost 3 years ago
Big release this time!
Every command line argument can now get defaults set using jbang config
. You can store the settings globally or using -f=.
to have them only take effect in a specific directory tree.
Really useful for setting default editor, i.e. jbang config set edit.open idea
to use idea as your default editor.
@quintesse worked hard on this and I'm sure it will save people a lot of extra typing.
@linux-china showed up contributing Groovy support similar to Kotlin. Still experimental but now you can get all the jbang advantages of compile jars, sharing using catalogs and alias with all the Groovy you like.
JBang will now when you pass it a markdown file like, jbang https://github.com/jbangdev/jbang/blob/main/itests/readme.md
it will extract the java/jsh code blocks and treat them as jshell. Allowing you to mix text and code that is both explanatory and runnable.
You can now add a //GAV mygroup:artifactid
to your file to have it be exported using jbang export mavenrepo
without having to list the GAV everytime.
--deps
on command line now support multiple dependencies separate by a comma(,) to allow much more compact command lines. Thanks to @grumpyf0x48!
@linux-china did not stop with Groovy support he also kicked of Intellij JBang support - give it at try from https://plugins.jetbrains.com/plugin/18257-jbang.
Hope you like this xmas release and when you try any of it out do please leave a comment of feedback on https://github.com/jbangdev/jbang/discussions - we love to hear the good as well as the bad to keep improving JBang !
catalog update
doesn't refresh cache (#1124)We'd like to thank the following people for their contributions:
Tako Schotanus, linux_china, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, allcontributors[bot]
Published by maxandersen almost 3 years ago
Get jbang-action publish to work again.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen almost 3 years ago
--repos
on cli and aliases reliably. This allows you do run a .java file that needs artifacts from other place than just maven central. i.e. jbang --repos jitpack com.github.maxandersen:jbang-to-maven:5877fa86aa
jdk
now works properly on bash in Windows (#1106)javac
should now work on Mac (#1112)main()
method lookup (#1104)info
on sources with //SOURCES
lines (#1097)We'd like to thank the following people for their contributions:
Tako Schotanus, Andres Almiray, Max Rydahl Andersen, GitHub, Geoffrey De Smet
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, allcontributors[bot]
Published by maxandersen almost 3 years ago
Quick fix release to fix brew installs that accidentally downloaded jbang into ~/.jbang/bin as it could not find the brew installed jar + fix for jbang init help message.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond
Published by maxandersen almost 3 years ago
Small minor, Quarkus devmode and properties handling now back and brew should not complain about deprecated instructions.
We'd like to thank the following people for their contributions:
Tomer Figenblat, Max Rydahl Andersen, GitHub, allcontributors[bot]
Published by maxandersen almost 3 years ago
Bug caused jbang/jbang.cmd not being included in distribution. Now reverted until proper fix in place.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen almost 3 years ago
Various fixes and a small but useful addition to jbang init
.
Lets us have jbang create a starting file with dependencies already filled in avoiding to do an extra round trip. I.e. to start using prettyTime do: `jbang init βdeps org.ocpsoft.prettytime:prettytime:5.0.2.Final trickortreat.Java
jbang.cmd
(#1038)We'd like to thank the following people for their contributions:
Rostislav Svoboda, Tako Schotanus, Michael Simons, Max Rydahl Andersen, GitHub
Published by maxandersen about 3 years ago
Linux had issues downloading Java when no java available. Now fixed.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen about 3 years ago
We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond
Published by maxandersen about 3 years ago
Bugfixes but also that --deps
on command line works properly with javafx so you now can for example run all the examples in @hansolo's charts library like this:
jbang --java 17 --deps org.openjfx:javafx-graphics:17:mac --deps eu.hansolo.fx:charts:RELEASE https://github.com/HanSolo/charts/blob/master/src/test/java/eu/hansolo/fx/charts/SankeyPlotTest.java
Also JBANG_EDITOR is once again honored by jbang edit
.
jbang
script (#1021)We'd like to thank the following people for their contributions:
Oliver Libutzki, Tako Schotanus, Max Rydahl Andersen, GitHub, Pierre-Yves Fourmond, Fred Bricon
Published by maxandersen about 3 years ago
Fixes so latest Adoptium / Temurin release is downloadable.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen about 3 years ago
Choco build was broken in release due to change in nuget - hopefully now fixed.
We'd like to thank the following people for their contributions:
Max Rydahl Andersen
Published by maxandersen about 3 years ago
jbang edit
now will open editor by default as opposed before you needed to do jbang edit --open
. If you want the old behavior use jbang edit --no-open
. This change is because if you really use edit it gets very tedious to write and many users did not seem to realise what jbang edit
actually can do.
With adoptopenjdk.net moving to Eclipse Adoptium we have the challenge that neither of their apis will give access to the full range of builds. Thus we moved to use api.foojay.io instead. Should not change anything for you as user but in case you see jbang fail to download/install a JDK where it worked before please let us know!
Other minor fixes and features found below!
--java-options
(#989)baseName
is no longer ambiguous (#999)version --update
works on Windows (#996)We'd like to thank the following people for their contributions:
Tako Schotanus, Max Rydahl Andersen, GitHub