You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jython scripts occasionally require JAR files from Maven Central. Unlike Groovy, Jython lacks a built-in mechanism to resolve these dependencies. However, you can bootstrap a Jython script along with its Maven dependencies using JBang. This technique ensures that your Jython scripts can seamlessly access the necessary dependencies from Maven Central.
Create fiie Jython.java and add all required DEPS to it.
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.python:jython-standalone:2.7.4
//DEPS io.leego:banana:2.1.0
import org.python.util.jython;
public class Jython {
public static void main(String[] args) {
jython.main(args);
}
}
test.py
from __future__ import print_function
import io.leego.banana.BananaUtils as BananaUtils
import io.leego.banana.Font as Font
text0 = "Jython 2.7"
text1 = BananaUtils.bananaify(text0, Font.STANDARD)
print(text1)
Running test.py
$ jbang run Jython.java test.py
Output
The text was updated successfully, but these errors were encountered:
Jython scripts occasionally require JAR files from Maven Central. Unlike Groovy, Jython lacks a built-in mechanism to resolve these dependencies. However, you can bootstrap a Jython script along with its Maven dependencies using JBang. This technique ensures that your Jython scripts can seamlessly access the necessary dependencies from Maven Central.
Create fiie Jython.java and add all required
DEPS
to it.test.py
Running test.py
Output
The text was updated successfully, but these errors were encountered: