Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide/faq for AOT main shim #140

Open
puredanger opened this issue Sep 19, 2016 · 1 comment
Open

Guide/faq for AOT main shim #140

puredanger opened this issue Sep 19, 2016 · 1 comment

Comments

@puredanger
Copy link
Member

"I wish there was more "best practice" out there about having a shim for -main and dynamically loading the rest"

hiredman added a commit to hiredman/clojure-site that referenced this issue Sep 19, 2016
@danielcompton
Copy link
Contributor

danielcompton commented Sep 19, 2016

Not sure how idiomatic it is (or if I've misunderstood the question), but here's what we use:

package our.cool_app;

import clojure.java.api.Clojure;
import clojure.lang.IFn;

public class Main {
    public static void main(String[] args) {
        try {
            IFn require = Clojure.var("clojure.core", "require");
            require.invoke(Clojure.read("our.cool_app.core"));

            Clojure.var("our.cool_app.core", "start!").invoke();
        }
        catch (Throwable e) {
            System.out.println(e.getMessage());
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants