Add jbang: single-file Java with JBang 0.132.1 on JDK 25 (deps, compact source files, Spring Boot, templates, native)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
7c677a39d2
commit
ddc3ec9d90
@@ -0,0 +1,18 @@
|
||||
//JAVA 25+
|
||||
//SOURCES Shout.java
|
||||
//FILES banner.txt=banner.txt
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* More than one file: //SOURCES pulls in Shout.java, //FILES makes banner.txt
|
||||
* available on the classpath as a resource.
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) throws Exception {
|
||||
try (InputStream in = Main.class.getClassLoader().getResourceAsStream("banner.txt")) {
|
||||
System.out.print(new String(in.readAllBytes()));
|
||||
}
|
||||
System.out.println(Shout.shout("one script, two sources, one resource"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/** A helper class living beside Main.java; JBang compiles it because Main lists it in //SOURCES. */
|
||||
public class Shout {
|
||||
static String shout(String s) {
|
||||
return s.toUpperCase() + "!";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
=== multi-file JBang demo ===
|
||||
Reference in New Issue
Block a user