JBang is an open source project that allows developers to script programs in Java, and optionally rely on dependencies hosted on Maven Central. Learn more about JBang from this InfoQ article.
This repository hosts the catalog of Microsoft projects with support for JBang.
Before continuing, install JBang.
To list the latest available artifacts in the Microsoft JBang's catalog, run the following:
$ jbang catalog list microsoftCurrently there are three projects:
- Minecraft: Java Edition Server
- Azure Application Insights Agent
- Playwright for Java
To start a Minecraft Java Server using JBang, follow these steps:
- Create a folder
minecraft-serverand get into it on your terminal. - Read and accept the Minecraft EULA. To accept the EULA, create a local file named
eula.txtwith contenteula=trueinside. - Run the server:
~/minecraft-server $ echo "eula=true" > eula.txt
~/minecraft-server $ jbang minecraft-server@microsoftOnce you start the server, a server.properties file will be created for further customizations. Learn more.
If you want to run this on a headless server, add nogui argument.
~/minecraft-server $ jbang minecraft-server@microsoft noguiPlaywright for JBang is a wrapper for the Playwright Java CLI.
Here's an example of how to generate a sample Playwright script. A browser window will start and the navigation flow will get recorded in the Example.java file.
$ jbang playwright@microsoft codegen -o Example.javaNow run the script. You will see the browser window open again, and the automated navigation flow.
$ jbang --deps com.microsoft.playwright:playwright:RELEASE Example.javaFor more command options, run:
$ jbang playwright@microsoft --helpTo run a jbang program with the App Insights agent enabled, run:
$ jbang --javaagent applicationinsights-agent@microsoft <yourapp>Where <yourapp> can be a single-source file script, a JAR, or even a GAV (Group, Artifact, Version coordinate) of an Apache Maven artifact.
To configure the agent, see the Azure Application Insights documentation.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.