Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in Clojure by

Hello All,

I am new to Clojure, just wrote my first program using an editor. While running it I get the following warning

% clj addition_function.clj WARNING: When invoking clojure.main, use -M 3

The program executes but I am confused by the warning and -M flag. If some one can throw a light for a beginner it would be good.

1 Answer

+2 votes
ago by

clj has recently grown a new way to launch and run clojure programs called "Exec function" using the -X flag. Until "Exec function" showed up the way to run a clojure program was "Run main". Because "Run main" was the only option that existed, there was no explicit flag for it. Now there are two options the implicit "Run main" is being deprecated in favor of the explicit -M flag.

I believe "main" in "Run main" refers to clojure.main which is a clojure namespace compiled to a java class of the same name, which is used to sort of bootstrap clojure execution. java needs a java class to execute, and clojure.main is a java class that knows how to execute clojure.

...