Monday, September 18, 2006

Scons Jar()

If a java file contains more than one class, javac uses $ (dollar sign) as a separator between class names, so the resulting classes look like:

TopClass.class
TopClass$InnerClass.class


Now, I want to put the classes into a .jar, so I do the following:

classes = env.Java(...)
env.Jar('all.jar', classes)


Sure enough, all.jar ends up containing only TopClass.class. Why? Because if I try

classes = ["TopClass.class", "TopClass$InnerClass.class"]
env.Jar('all.jar', classes)


I get parse error in the first line because "$InnerClass.class" is interpreted as a variable either by scons or by python.. (well, otoh usual python does not have any problems with the first line)

Let's see what people from the news group tell us, and use a shell script meanwhile.

No comments: