I have now seen several projects ending at a point where the actual configuration depended on things only available at run-time.
The typical way to configure a Java prog
I know you want a small size and runtime. Scheme is the usual choice for easy embedding, and would be my first choice. But I have no information on that field, though. My second choice is Clojure:
A respective code with using Clojure:
import clojure.lang.RT;
import clojure.lang.Var;
import clojure.lang.Compiler;
import java.io.FileReader;
import java.io.FileNotFoundException;
public class ClojTest {
public static void main(String[] args) throws Exception {
try {
Compiler.load(new FileReader("hello.clj"));
} catch(FileNotFoundException e) { return; }
System.out.println("Message: '"+ RT.var("user", "msg").get() +"'");
// Values
int answer = (Integer) RT.var("user", "answer").get();
// Function calls
System.out.println(RT.var("user", "countdown").invoke(42));
}
}
with hello.clj
being:
(ns user)
(defn countdown [n]
(reduce + (range 1 (inc n))))
(def msg "Hello from Clojure!")
(def answer (countdown 42))
Running time java ClojTest
for a while yields in an average of 0.75 seconds. Clojure compiling the script has quite a penalty!