Skip to content

Guide/faq for AOT main shim #140

Open
@puredanger

Description

@puredanger

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

Activity

danielcompton

danielcompton commented on Sep 19, 2016

@danielcompton
Contributor

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @puredanger@danielcompton

        Issue actions

          Guide/faq for AOT main shim · Issue #140 · clojure/clojure-site