Skip to content

Instantly share code, notes, and snippets.

@rramsden
Created August 23, 2011 03:02
Show Gist options
  • Save rramsden/1164238 to your computer and use it in GitHub Desktop.
Save rramsden/1164238 to your computer and use it in GitHub Desktop.
@Override
public void onLoad() {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
crafty = executeScript(getClass().getResourceAsStream( "/crafty/core.clj" ), "/crafty/core.clj");
} catch (Exception e) {
System.out.println(e.getMessage());
}
protected Object executeScript(InputStream ins, String path) {
int slash = path.lastIndexOf('/');
String file = slash >= 0 ? path.substring(slash + 1) : path;
try {
return Compiler.load(new InputStreamReader(ins), path, file);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment