On Nov 24, 4:03 pm, Stuart Sierra <[EMAIL PROTECTED]> wrote:
> Hi Perry, Stephen,
> I like the "convention over configuration"-ness of defaulting to ./
> classes. One thought: Weird errors might result if ./classes is not
> on classpath. Is there an easy way to check that, and display a
> helpful error message?
>
Right, good idea. It would just take checking to see if the "path"
variable is in System.getProperty("java.class.path"), right?
--
Answer: no. I tried the approach below against Stephen's
clojure.lang.Compile, & the ant build process failed. All of the
classes currently on the classpath are evidently not reflected in the
system property -- at least when running in Ant. (I believe they would
be when invoking java w/ the -cp option.)
---- FAILED APPROACH -----
Boolean found = false;
for ( String cp : System.getProperty("java.class.path").split(":") ) {
if (cp == path) {
found = true;
}
}
if (!found) {
err.println("System property " + PATH_PROP + " (the current value
of "+
"which is" + path +") must be in your
CLASSPATH.");
System.exit(1);
}
-------------
Another approach would be to just catch the
java.lang.ClassNotFoundException that would be triggered if the
clojure.compile.path isn't on the classpath. Better ideas, Stephen?
Perry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---