javagocompileAndGo script using JavaWrap Java code in a compileAndGo script, as in the example below. Once-only compilation is automatic; class files are cached out of sight; source and invocation script are both in the one file. See the modtime script for a Java example requiring a library in the classpath.
Here's how it works.
1 Z% ./javago Hello, folks of World! 2 Z% |
Here’s the javago script. After that I’ll show you how to do the same thing with gcj.
#!/usr/bin/env compileAndGo
langauge = java
!#
public class javago {
public static void main(String[] args) {
System.out.println("Hello, " + (args.length >= 1 ? args[0] : "folks of World") + "!");
}
}
|
gcj (Gnu compiler for Java)Just as simple:
#!/usr/bin/env compileAndGo
langauge = java
compiler = gcj
!#
public class javago {
public static void main(String[] args) {
System.out.println("Hello, " + (args.length >= 1 ? args[0] : "folks of World") + "!");
}
}
|
Perhaps there is a tool somewhere that will encapsulate a binary resource file into a Java source file as static initialization data. I imagine a command something like this:
binaryToJava javax.swing.ImageIcon icon.gif MyIcon.java
(“Hello, folks of World!” is the Goon Show variant of “Hello, world!”)