cljs.jar is self-contained (includes its dependencies) and includes Clojure 
itself (including clojure.main).

The cljs.jar is built using this script:

https://github.com/clojure/clojurescript/blob/master/script/build

You can walk through that process to learn more if needed.


On Saturday, August 5, 2017 at 12:15:31 PM UTC-5, Jay Martin wrote:
>
> In the "ClojureScript Compiler" section of the ClojureScript Quick Start 
> Guide <https://clojurescript.org/guides/quick-start>, we run the build 
> script with the java command:
>
> java -cp cljs.jar:src clojure.main build.clj
>
>
> This command starts a JVM and loads the cljs.jar file and all of the 
> contents of the 'src' directory, to the JVM Classpath.
>
> According to the man page for the java program, clojure.main is a class 
> file, (I'm assuming this one 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fclojure%2Fclojure%2Fblob%2Fmaster%2Fsrc%2Fjvm%2Fclojure%2Fmain.java&sa=D&sntz=1&usg=AFQjCNGvBUQ46skdR5RrGZG1INZmSOpElw>)
>  
> and build.clj is its argument.
>
> My question is: *How is the clojure.main class getting loaded to the 
> classpath?*
>
> Obviously clojure.main is part of Clojure. By unzipping the cljs.jar, I 
> see that it has a project.clj file with the following contents:
>
> (defproject org.clojure/clojurescript "0.0-SNAPSHOT"
>   :description "ClojureScript compiler and core runtime library"
>   :parent [org.clojure/pom.contrib "0.1.2"]
>   :url "https://github.com/clojure/clojurescript";
>   :license {:name "Eclipse Public License"
>             :url "http://www.eclipse.org/legal/epl-v10.html"}
>   :jvm-opts ^:replace ["-Dclojure.compiler.direct-linking=true" "-Xmx512m" 
> "-server"]
>   :source-paths ["src/main/clojure" "src/main/cljs"]
>   :resource-paths ["src/main/cljs"]
>   :test-paths ["src/test/clojure" "src/test/cljs" "src/test/self" 
> "src/test/cljs_cp"]
>   :dependencies [[org.clojure/clojure "1.8.0"]
>                  [org.clojure/data.json "0.2.6"]
>                  [org.clojure/tools.reader "1.0.3"]
>                  [org.clojure/test.check "0.10.0-alpha2" :scope "test"]
>                  [com.cognitect/transit-clj "0.8.300"]
>                  [org.clojure/google-closure-library 
> "0.0-20170519-fa0499ef"]
>                  [com.google.javascript/closure-compiler-unshaded 
> "v20170626"]
>                  [org.mozilla/rhino "1.7R5"]]
>   :profiles {:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
>              :uberjar {:aot :all :main clojure.main}}
>   :aliases {"test-all" ["with-profile" "test,1.5:test,1.6" "test"]
>             "check-all" ["with-profile" "1.5:1.6" "check"]}
>   :min-lein-version "2.0.0")
>
>
> [org.clojure/clojure "1.8.0"] is listed as a dependency. Is this how 
> Clojure is getting loaded to the JVM Classpath?
>
> If so, how is this happening? It doesn't seem like the java program would 
> be smart enough to parse a project.clj file. 
>
>
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to