Editing

You can edit your script in an IDE/editor by using jbang edit helloworld.java. This will generate a project in a temporary location with symbolic links to your script and open a editor.

jbang edit helloworld.java

By default jbang will offer to install VSCodium (free/libre version of Visual Studio code) with default java extensions enabled in so called "portable mode". Portable mode means all the installed binaries and configuration does not affect rest of your system; everything is stored in ~/.jbang/editor.

This automatic install and setup of editor is fully optional and if you have another IDE or editor already installed use it using jbang edit --open=<editor> or set JBANG_EDITOR environment variable to have jbang use it by default.

jbang edit --open=[editor] helloworld.java

Finally you can also if you prefer to call the editor/IDE yourself in a shell that supports variable evaluation specify --no-open to tell JBang to not open an editor.

code `jbang edit --no-open helloworld.java`

If you add further dependencies to your file just re-run the edit command and the relevant files will be regenerated with the updated dependencies.

On Windows you might need elevated privileges to create symbolic links. If you don’t have permissions then the edit option will result in an error. To use it enable symbolic links for your user or run your shell/terminal as administrator to have this feature working.

Live Editing

You can also use jbang edit --live and jbang will launch your editor while watching for file changes and regenerate the temporary project to pick up changes in dependencies.

IDE and Editor support

The edit feature been tested with the following IDE’s:

Table 1. IDE’s and Editors tested with jbang

50 Visual Studio Code

50 Eclipse

50 IntelliJ Idea

50 Apache NetBeans

50 Neovim w/ spacevim Java

50 Emacs w/ Spacemacs Java

The edit feature works with various IDE’s - it generates a build.gradle to use with IDE’s that understands Gradle directly. For speed and consistency jbang also generates IDE specific settings.

Currently launchers and project files are generated for Eclipse and vscode. Intellij just reads build.gradle for now thus to run/debug you will need to manually set it up.

Some editors like Code or IDEA are not per default executable / startable from the command line. Here are some helpfull documentations for supporting command line usage of different editors: